Deborah R. Fowler
VSFX 160 - In-class
OOP
Posted on Nov 4 2018
DATE ASSIGNED: Class 17
DATE DUE: Class 20
OOP in Python: Interactive Student Database
Specifications:
The program should read in a file of student records in the
following format:
StudentSurname StudentGivenNameExplanation:
YearInProgram
Assignment1Grade Assignment2Grade Assignment3Grade Assignment4Grade
StudentSurname: The student’s surname. Contains no white space.Example:
StudentGivenName: The student’s given name. Contains no white space.
YearInProgram: The student’s year of study. A whole number ≥ 1.
Assignment1Grade: The student’s grade on the first assignment. (Whole numbers from 0 to 100)
Assignment2Grade: The student’s grade on the second assignment.
Assignment3Grade: The student’s grade on the third assignment.
Assignment4Grade: The student’s grade on the fourth assignment.
Here is an example of a data file to be read by the program:
Cool Joe
3
99 80 100 70
Brown Sally
1
80 99 70 100
VanPelt Linus
2
65 82 38 40
For this exercise you
may assume that no two students have the same surname/given name
combination.
Program Output and Behavior Specification:
Once you have the average being calculated go on to the next
challenge. Once the program has read in the data file, it should
request and process interactive queries from the user. It
should request queries in the following format:
Student data read in.
Query student average[a], maximum grade[m], year[y] or
exit session[e]?
If the user responds by entering a, the program
should request a student name:
Student data read in.
Query student average[a], maximum grade[m], year[y] or
exit session[e]? a
Student Name?
After the user enters the student’s name, the program
should compute and output the student’s average and then request
the next query:
Student data read in.
Query student average[a], maximum grade[m], or year[y] or
exit session[e]? a
Student Name? Brown Sally
Brown Sally average is 87.25
Query student average[a], maximum grade[m], or
year[y] or exit session[e]?
The user can also request a student’s academic
year by entering y, or exit the program by entering e.
Program
Structure:
The program must use an object oriented approach: specifically it
must use an object to store each student’s data, and provide that
object with methods to return and/or output each student’s
average, maximum grade, and academic year.
Error
Handling:
For this exercise, you can assume that the student data input file
is properly formatted. However, the program should gracefully
handle incorrect interactive input from the user. For example, if
the user does not respond with a, m, y or e to the program’s query
request, or provides the name of a student not in the database,
the program should respond sensibly, and definitely not crash or
freeze.