For this assignment, you are to complete the development of a Java program, called GPAApplication, that produces as output an end-of-semester grade report that lists each student's name, birthdate, semester grade point average, and possibly an annotation (e.g., "Dean's List"). An example report, and the small input set that was used in generating it, appear side-by-side below.
|
|
As you can infer from the provided sample data, each student's semester performance is described using data spread over several lines:
As you can see, the report has column headings and the entries in the columns are nicely aligned. The code provided to you includes the printHeading() method, which prints both the headings and the "horizontal line" underneath them. The provided code also includes the printStudent() method, which is to be used to print a student output record. Both of these methods call the System.out.printf() method, which is useful for producing nicely aligned columns of data.
As you can infer from the sample report, students' birthdates are to be displayed in the dd-Mon-yyyy format (including leading zeros where appropriate) and students' names are to be displayed in "last-comma-first" format. Thus, it will be necessary for the program to convert names and calendar dates from one form to another.
The program begins by prompting the user to enter the name of the file from which it should read input data. The code provided establishes the necessary connection between a Scanner object and the input file.
It is suggested that, to read a student's name, you use the Scanner's nextLine() method, which will return a string that includes the entire name (i.e., all two or three parts). You can then extract from that string the two needed parts (i.e., first and last names).
To read each of the other pieces of data, use either next() or nextInt(), the latter only if the token to be read represents an integer value. At the conclusion of reading each student's data, call the Scanner's nextLine() method for the purpose of advancing its cursor to the beginning of the next line, where the following student's name is found.
The EmployeesGrossPay application (see link on course web page in the "Programming Samples: Relevant to Chapter 6" subsection) is very similar to this one, so you are advised to examine it.
Also closely examine the code in the class that you are to finish. It provides a solid foundation on which you can build, including several stubbed methods.
As in a previous assignment, you are encouraged to develop your solution incrementally. Suggested increments are as follows:
Mary Barbara Smith 20001114 4 Richard Sharkface 20020502 3 Chris Alex Glorkhead 19991221 4 |
Smith, Mary 14-Nov-2000 4 Sharkface, Richard 02-May-2002 3 Glorkhead, Chris 21-Dec-1999 4 |
Smith, Mary 14-Nov-2000 13 39.660000000000004 Sharkface, Richard 02-May-1940 9 34.019999999999996 Glorkhead, Chris 21-Dec-1969 14 25.0 |
Smith, Mary 14-Nov-1992 3.050769 Sharkface, Richard 02-May-1940 3.780000 Dean's List Glorkhead, Chris 21-Dec-1969 1.785714 Academic Probation |
Of course, you have some freedom regarding the order in which you carry out the tasks corresponding to these increments. For example, you can wait until the last step to convert the names and/or birthdates to the desired forms, and you can start using the printHeading() and printStudent() methods a little earlier than suggested. However, it's vital that your first step be to parse the input data correctly. If your program can't do that, it can't do much of anything.
The sample data file provided to you is very small. To do a decent job of testing your work, you need apply your program to a more extensive set of data. At a minimum, it should include birthdates covering all 12 months and course grades covering all possibilities, from A through F.
To impress your instructor, incorporate either or both of these two enhancements:
Be aware that you can submit more than one time. Hence, if, after submitting, you improve your program (e.g., by fixing logic errors), you should submit the newer version (but always with the same name!).