Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions

Question

Describe the appropriate use of supplementary parts of a letter.

Answered: 1 week ago