;MSACS graduation program checklist program ; July 11, 2004 ;gradchk2.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 askfordata (phase atstart) => (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 askfordata2 (phase atstart) => (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 (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) ) (defrule toomanyChours (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) )