Assignment 5: Prolog Programming Solution