The Registrar's office at a local college maintains a database of student records. In this assignment, you will develop data definitions and functions for student records.
Remember that all functions should have a contract and a purpose, and should
be tested using check-expect
.
A student record is specified as follows: the student's name, ID number, home address, year of graduation, grade point average, and number of credits earned so far. The home address consists of a street, city, state, country, and zip code (or postal code).
Develop a data definition for a student record and an address. The data definition consists of the define-struct's needed to model your definitions, and the accompanying documentation. Provide three examples of each type of data definition.
In a comment in the definitions window, state all of the operators (with their contracts) that DrRacket defines as a result of your define-struct's in the previous question.
deans-list?
that consumes a student record
and returns true if the GPA of the student is 3.5 or higher. Otherwise,
the function returns false.
credits-to-graduate
that consumes a
student record and the total number of credits required for
graduation, and produces the number of credits the student has left to meet
the graduation requirement. (For example, if 120 credits are required for
graduation, and the given student has earned 90 credits so far, the
function should produce the value 30.)
add-credits
that consumes a
student record and a number of credits and produces a student record.
The student record that's returned is the same as the original, except that
the given number of credits have been added to the student's total.
update-address
that consumes a student
record and an address and produces a student record. The student record that's
produced contains the updated address information.
delay-graduation
that consumes
a student record and a threshold value for a GPA. The function returns a
student record. If the GPA of the
given student is below the given GPA, then the student's year of graduation
is increased by one. Otherwise, the student record is returned unchanged.
Develop a data definition for a date, consisting of a month, day, and year.
Give three examples of dates. Then write a function earlier-date
that consumes two dates and returns the one that occurs earlier.
Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Name your file
yourLastName-hw2
For example, if your name is Jane Doe, you would name your file
doe-hw2
. In addition,
your name and your wpi ccc username must
appear in a comment at the top of the file. Programs will not be accepted
for submission after 5pm on Tuesday, September 7.