Can a class object count as part of the two-dimensional
structure?
Yes, under the following conditions: Your class object is a reference
to an array or a reference to a hash, and your main program makes good
use of a hash of objects or an array of objects.
What should be computed for the final grade if ...?
If there are no grades, both methods should compute 0.
If there are no exam grades, both methods should compute the final
grade to be equal to the Homework average.
If there are no homework grades, both methods should compute the final
grade to be equal to the Exam average.
If there are both homework and exam grades, one method should compute
70% of the homework average plus 30% of the exam average. The other
method should compute 60% of the homework average plus 40% of the exam
average.
In the Change Grade subroutine, what options do we present if
there are no homework grades or no exam grades?
Regardless of the grades already entered, you should still present the
user with the sub-menu:
H)omework Grade
E)xam Grade
Then, when the user makes his/her choice, if there are no grades of
that type, print out an error and return to the main menu.
What are the valid options for a grade?
For simplicity's sake, only non-negative whole numbers may be
considered acceptable. Note that there is no maximum acceptable grade
(hoo-rah for extra credit...)
Is every student required to have the same number of grades for
each type?
No. The number of grades for each student is completely independent.
You could have one student with 5 exams and 4 homeworks, and another
with 2 exams and 10 homeworks, and another with 20 exams and 0
homeworks.
For the final grade methods, can we store the two quantities in
our datastructure or file and update when a grade is added or changed,
or do we have to compute each quantity every time it's needed (Print
Student Info, Print All Students)?
That decision, like all internal design decisions (other than having a
2-d structure and the UI), are entirely up to you.
How do you remove a member of a hash or an array?
For an array, use the pop, shift, and splice functions as
appropriate.
For a hash, you can remove an element from %hash whose key is "key" by
delete $hash{"key"};
If there are no students, and the user selects "add grade" or
"print student info" or something similar, do we still have to ask for
which student?
Yes. For every menu option, you should print out all levels of
input/output, and only at the very end do the error checking. I know
this doesn't make for a very good 'real world' program, but it's the
only way to allow my TAs to grade the programs quickly and easily.
What happens if the file passed in on the command line does not
exist or otherwise cannot be opened?
Your program should print an error message, and then run as though no
command line parameters were passed in (ie, it should start without
any data, and should prompt for a file name at the end).
What should we do if more than one file is passed in on the
command line?
User error. Immediately abort the program and tell the user to enter
either 0 or 1 arguments.
I'm getting compiler errors about mkdir when I try
to run ~lallip/public/submit4.pl
You've neglected to run setup perl-new