;MSACS graduation program checklist program ; July 11, 2004 ;gradchk3.clp (deffacts initial-facts "These are defaults needed prior to execution" (minimum-hours-to-graduate 36) (maximum-C-hours 8) (phase atstart) ) (defrule graduate-rule "This is the core set of graduation requirements" (student-hours ?stuhours) (student-C-hours ?stuChours) (minimum-hours-to-graduate ?min-hours) (maximum-C-hours ?maxChours) (test (>= ?stuhours ?min-hours)) (test (<= ?stuChours ?maxChours)) => (assert (OK to graduate)) (fprintout t crlf crlf " >> OK to graduate!" crlf crlf) ) (defrule askforcredithours "Asks user for credit hours completed by semester of graduation" (phase atstart) (not (phase done)) => (fprintout t crlf "Enter the number of hours that " crlf) (fprintout t "will be completed by the semester of graduation:") (assert (student-hours = (read))) ) (defrule askforCgrades "Asks user for hours of grade C or less " (phase atstart) (not (phase done)) => (fprintout t crlf "Enter the number of hours completed " crlf) (fprintout t "with a grade of C or worse:") (assert (student-C-hours = (read))) ) (defrule nonenoughthours "Tests hours for graduation and provides feedback" (student-hours ?stuhours) (minimum-hours-to-graduate ?minhours) (test (< ?stuhours ?minhours)) => (fprintout t crlf crlf " >> You don't have enough hours to graduate - 36 minimum. ") (fprintout t crlf " >> You have " ?stuhours " hours." crlf crlf) (assert (phase done)) ) (defrule toomanyChours "Tests hours at C or less and provides feedback" (student-C-hours ?stuChours) (maximum-C-hours ?maxChours) (test (> ?stuChours ?maxChours)) => (fprintout t crlf crlf " >> You have more than 8 hours. ") (fprintout t crlf " >> With a grade of 'C' or worse. You have " ?stuChours " hours." crlf crlf) (assert (phase done)) )