Start by copying over my starting point code:
# from your cs21/hw06 subdirectory: % cp ~newhall/public/cs21/hw06/* .
note: I recommend doing parts 1-7 of this assignment before the midterm exam. As practice for the exam, first try writing up your solution to a method on paper, then type it in and test to see if it is correct. Give yourself about 15 minutes to write your solution on paper (this is about the amount of time you would have on the exam to read a problem and write down your solution).
Starting with the starting point code, you will add some methods that take array parameters, and then you will add code to main to test out these methods. Remember to implement and test incrementally to make debugging easier (i.e. implement one method, compile it, call it to test it out, then implement the next method, compile it, test it, and so on).
Here are things to add to the starting point code:
Format of input file Example File -------------------- ------------- number of grades per exam 4 exam1, grade1 99 examl, grade2 78 ... 54 exam1, gradeN 75 exam2, grade1 76 exam2, grade2 97 ... 83 exam2, gradeN 100
PrintIntArray(exam1, 10, "Exam 1:", 5);Would print out something like:
Exam 1: 60 88 70 55 82 90 98 78 64 76Call your PrintIntArray method to print out the contents of both exam arrays, 10 grades per line.
The starting point code contains a stub method for PrintArray...you need to add the code
min grade max grade ave grade std dev --------- --------- --------- ------- Exam1: 44 99 72.400 17.990 Exam2: 26 99 67.750 23.545
A call to this method may look like
int[] histogram; histogram = Histogram(exam1, num_grades);
For example, the call to:
AsciiHistogram(histogram, num_buckets, 0, 100, 10);May print out the following ascii graph representation of the histogram data (here there would be 1 grade in the range 20-29, 1 in the range 30-39, 4 in the range 40-49, and so on):
Histogram with bucket size of 10: 0- 9: 10- 19: 20- 29: * 30- 39: * 40- 49: * * * * 50- 59: * * * 60- 69: * 70- 79: * * * 80- 89: * * * 90- 99: * * * * 100 : * *
% java StaticGradeInfo grade.data exam 1: 88 76 77 99 45 50 44 99 89 77 66 55 44 56 98 78 88 66 77 76 exam 2: 26 57 98 44 88 76 89 77 66 77 99 45 88 99 33 44 50 99 44 56 min grade max grade ave grade std dev --------- --------- --------- ------- Exam 1: 44 99 72.400 17.990 Exam 2: 26 99 67.750 23.545 Exam 1: ------- Histogram with bucket size of 10: 0- 9: 10- 19: 20- 29: 30- 39: 40- 49: * * * 50- 59: * * * 60- 69: * * 70- 79: * * * * * * 80- 89: * * * 90- 99: * * * 100 : Exam 2: ------- Histogram with bucket size of 10: 0- 9: 10- 19: 20- 29: * 30- 39: * 40- 49: * * * * 50- 59: * * * 60- 69: * 70- 79: * * * 80- 89: * * * 90- 99: * * * * 100 :