Question: Write a program called ComputeGPA to compute a GPA from letter grades. Write the program so that it: Declares and creates a symbol table using

Write a program called ComputeGPA to compute a GPA from letter grades. Write the program so that it:

Declares and creates a symbol table using the algs31.BinarySearchST class;

Fills that symbol table with the following key-value pairs:

Letter Points
A+ 4.33
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.00
F 0.00

Reads a sequence of letter grades from a file called a1grades.txt using standard input, that is, using the method fromFile in the class StdIn in the stdlib package. As each grade is read, the program accumulates a total number of grade points by using the symbol table to convert a letter grade to a point value;

Computes and prints the GPA.

You may assume that the letter grades are separated from each other with whitespace. Create your own test file called a1grades.txt and place it in the data directory. Remember that your program will open it using the pathname data/a1grades.txt. Do not submit your test file.

PLEASE NOTE: Do not copy any code from the algs31.BinarySearchST class. You will have a single line in your program that declares and creates an empty symbol table and then you will need to call the instance methods put and get.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!