You have one hour to complete a program that reads a series of courses and grades, and returns a summary of how many courses there are and what the average GPA is. The format of the data you will be reading is as follows:
CS 234 A
MAT 243 B+
...
Namely, each line consists of a sequence of letters indicating the department, followed by a number of spaces and then the course number. After one or more spaces a letter grade for the course is present. The letter grades correspond to GPA scores as follows:
A 4.00
A- 3.67
B+ 3.33
B 3.00
B- 2.67
C+ 2.33
C 2.00
C- 1.67
D+ 1.33
D 1.00
F 0
W The course should not count at all towards the total or the GPA calculation.
You are given some code to help you get started. You will need to:
grades
project from GitHub: https://github.com/sdp-resources/gradesMain.java
.sdp
. They should all be failing right now.The method you need to write, processGrades
is given as input a “scanner”. A scanner is going to skip whitespaces and return the remaining “tokens” to you when you call an appropriate next...
method of it. Check out the Java Scanner documentation for more details.
These are further directions that we will take this program. We’ll ideally want our code to accomodate them.