Programming in Perl

Homework 4

User Interface Specifications

After parsing the input file, if given, your program enters a loop. At the beginning of the loop, print out a menu as follows:
1) Print Student Info
2) Print All Students
3) Add Student
4) Remove Student
5) Add Grade
6) Change Grade
0) Save changes and exit
After printing the menu, print a prompt for the user to select one of these options. Take in the user's input. What your program does next depends on this input:

1

Print out a prompt asking "Which student's information do you want to print?". The user will enter an RCS Id or a RIN. Your program will then print that student's First and Last Name, RCS Id, RIN, all homework grades, and all exam grades. It will finally compute two final grades: one in which the homework average weighs 70% and the exam average is 30%, and one in which homework is 60% and exams are 40%. Print out both of these computations (correctly identified).

2

Print a menu as follows:
A) Sort by Last Name
B) Sort by Final Grade
Take in the user's choice (case insensitive). Then print out, for every student, the First Name, Last Name, and final grade, sorted ASCIIbetically (A comes before B) for Last Name, or numerically (100 comes before 99) for Final Grade. The final grade for this option is the maximum of the quantities computed by the two methods.

3

First, prompt the user for the new student's Last Name. Take in the user's input. Then prompt for the Frist Name, and take in the input. Then for the RCS Id and take it in, and finally for the RIN and take that in.

4

Print out a prompt asking for which student. The user will enter either an RCS Id or a RIN. Remove that student from the system.

5

Print a prompt asking for which student. The user then enters either an RCS Id or a RIN. Print out a menu as follows:
H)omework Grade
E)xam Grade
The user will enter either H or E (case insensitive). Then print a prompt asking for the new grade. Take in that grade and add it to the system.

6

Prompt the user for a student. The user enters either an RCS Id or a RIN. Print out the student's information as follows (for example):
Paul Lalli
Homework: 100, 95, 102, 94
Exam: 84, 90
Prompt the user for Homework or Exam, as in the Add Grade option. If the user enters H, print a menu as follows:
Change which grade?
1) 100
2) 95
3) 102
4) 94
If the user enters E, print a menu as follows:
Change which grade?
1) 84
2) 90
Take in the number the user enters, ask for the new grade, and change it in the system.

0

If the program originally took in the database file on the command line, open this file for writing and print all students' information to it. If not, prompt the user for the name of a file, take in this input, open the file for writing, print all the information to it, and close the file. You should then end the program.
At any step along the way, if the user enters any kind of faulty information (number instead of letter, number out of range, RIN or RCS Id that doesn't exist, etc) simply print the appropriate error message, and immediately go back to the main menu.

A sample run through of your program will be available in a few days. I'll post an announcement to the webpage and the mailing list when it is ready.