Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program to calculate grade-point average, given a list of courses and grades that have been completed. 1. Write classes for Calculator and

Write a Java program to calculate grade-point average, given a list of courses and grades that have been completed. 1.Write classes for Calculator and Course. Put the main function in the Calculator class. 2.All input data will come from the le \courses.txt". It has one course grade and course number/name on each line, in this format: A CS 604 Introduction to C Programming C CS 610 Intermediate Programming in C A CS 622 Database Systems B CS 646 Introduction to Computer Security When all course data has been read from the file, close the file. 3.Create Course objects using the input data and store them. The number of courses in the file will change from one run to the next. There will be at least one course, but no maximum number can be given. 4.The only possible grades are A, B, C, D and F. Compute the gpa according to this formula:

A = 4 points, B = 3 points, C = 2 points, D= 1 point, F = 0 points

Add up the points earned and divide by the number of courses taken.

5. If an invalid grade is encountered, the program should close the file and put an error message on the screen.

6. When all data has been stored, display the course number, description, and grade on the screen with the gpa at the bottom.

Above java program should satisfy all of below conditions.

Design Principles and Style All data members are private.

Each class has the appropriate parts, that is, parts that belong in class B are in class B not in class A.

Constructors are written and used appropriately.

Appropriate built-in Java classes and data structures are used.

The comments in the program add to the clarity. They don't clutter it or mislead the reader.

Indentation is reasonable and consistent. Names are reasonable. (b) Functionality and Correctness The program follows these instructions! Invalid grades are handled properly

The le is opened correctly and opening exceptions are handled properly.

The le-read loop and end-of- le are handled correctly.

Letter grades are converted to numeric values and the gpa is calculated correctly.

The program runs to completion. It does not go into an in nite loop or abort with an avoidable exception.

Output is provided for a run with three, ve, seven, and ten courses.

The output is a neat list of course data, with two neat columns.

The gpa is printed at the end.

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

4. Show the trainees how to do it again.

Answered: 1 week ago

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago