student('Ali', 85).
student('Chris',92).
student('Kendall', 89).

grades :- writeln('Current Grades'),
    student(Student,Score), grade(Score,Grade),
    format(' ~w: ~w\n', [Student, Grade]), fail.
grades.
	
%/*
grade(Score, 'A') :- Score >= 90.
grade(Score, 'B') :- Score >= 80, Score < 90.
grade(Score, 'C') :- Score >= 70, Score < 80.
grade(Score, 'F') :- Score < 70.
%*/

/*
grade(Score, 'A') :- Score >= 90.
grade(Score, 'B') :- Score >= 80.
grade(Score, 'C') :- Score >= 70.
grade(_, 'F'). :- Grade = 'F'.
*/

/*
grade(Score, 'A') :- Score >= 90, !.
grade(Score, 'B') :- Score >= 80, !.
grade(Score, 'C') :- Score >= 70, !.
grade(_, 'F'). :- Grade = 'F'.
*/

/*
grade(Score, 'A') :- !, Score >= 90.
grade(Score, 'B') :- !, Score >= 80.
grade(Score, 'C') :- !, Score >= 70.
grade(_, 'F'). :- Grade = 'F'.
*/

print_grade(Score) :- grade(Score,Grade),
    format('~w -> ~w\n', [Score, Grade]).

