CMPS 134 Fall 2019
Programming Assignment #5: GPA Application
Due: 11:59pm, Thursday, October 31

Requirements

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.

Input
Mary Barbara Smith
20001114
4
CMPS134 3 A
ENGL101 3 B+
PSYC235 3 C+
MATH114 4 B-
Richard Sharkface
20020502
3
MUSIC432 3 A
ART114 3 A-
HIST257 3 A-
Chris Alex Glorkhead
19991221
4
T/RS101 3 B+
MATH221 4 D
CMPS144 4 F
HIST354 3 A-
Resultant Report
Name                     Date of Birth  GPA   Annotation
------------------------------------------------------------------
Smith, Mary              14-Nov-2000    3.05
Sharkface, Richard       02-May-2002    3.78  Dean's List
Glorkhead, Chris         21-Dec-1999    1.79  Academic Probation

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.


Suggestions

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:

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.


Additional/Optional (Extra Credit)

To impress your instructor, incorporate either or both of these two enhancements:

  1. The "Dean's List" annotation should not be displayed for a student who took fewer than 12 credits.
  2. Allow for the possibility that a student was enrolled in zero courses. In that case, the displayed GPA should be zero. (Even better, display a dash in place of a number.)

Program Submission

Submit your source code file (GPAApplication.java) into the prog5_dir folder in the usual way. (Again, submit the .java file, not the .class file.) Make sure to include comments in your program identifying yourself, indicating that it is a solution to Prog. Assg. #5, acknowledging any persons who aided you in devloping your solution, and pointing out any flaws of which you are aware.

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!).