Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Computer Programming IInstructor: Greg Shaw COP 2210 Programming Assignment #3 Creating a Class You can count on the fingers of one hand of a Disney

Computer Programming IInstructor: Greg Shaw

COP 2210

Programming Assignment #3

Creating a Class

You can count on the fingers of one hand of a Disney character the number of professors who have not received the following entreaty or some variation thereof:

"Hey professor, I know I only earned a C+ in your class but if you could possibly make it a B- I would really appreciate it, and it would really help my GPA!"

Hmmm, would it really? Let's program to find out!

I. Background Information

Grade points earned for a course are the number of credits the course is worth times the numeric grade earned

Use the FIU scale for the numeric grade where A = 4.0, A- = 3.67, B+ = 3.33, B = 3.0, B- = 2.67, C+ = 2.33, C = 2.0, D+ = 1.33, D = 1, D- = 0.67, and F = 0.0

Example: A "B+" grade in a 3-credit class would be worth 9.99 grade points (3.33 x 3)

II. The GradeChanger Class

Your GradeChanger class will enable the user to replace a student's given grade in a course with a new one, to add a new course grade, and to compute the GPA.

Your class will have

1.two private instance variables that store the total credits earned in all courses (an int) and the total grade points earned (a double)

2.A constructor with two parameters - total credits and GPA - which will be used to initialize the instance variables

F total grade points is not a construction parameter; GPA is.Your constructor will initialize total grade points to GPA x total credits

3.An accessor ("get") method that returns the total credits

4.An accessor ("get") method that returns the total grade points

5.A mutator ("set") method that adds the grade for a new course. This method will have 2 parameters - the number of credits and the numeric grade earned

6.A mutator method that replaces the current grade for a course with a new grade. This method will have 4 parameters - the old number of credits, the old numeric grade, the new number of credits, and the new numeric grade

7.A method that computes and returns the GPA

III. Your Test Class

Your test class will have only a single method - main - and will perform each of the following operations, in order:

1.get a GradeChanger object with a given number of credits and GPA

2.Get and print the initial total credits and initial grade points

3.Get and print the initial GPA

4.Call the method that adds a new grade with a given number of credits and numeric grade

5.Get and print the updated total credits and grade points

6.Get and print the updated GPA

7.Call again the method that adds a new grade with a given number of credits and numeric grade

8.Get and print the updated total credits and grade points

9.Get and print the updated GPA

10.Call the method that replaces a grade (with a given number of credits and numeric grade) with a new grade (with a given number of credits and numeric grade)

11.Get and print the updated total credits and grade points

12.Get and print the updated GPA

IV. Data to be Used

Although your GraderChanger class must work correctly for all valid data values, use this data in the run you hand in:

Initial credits and gpa (step 1):60 and 3.0

First new grade added (step 4):3 credits and 3.33

Second new grade added (step 7):4 credits and 4.0

(Like in our class!)

Grade to be replaced and new grade to replace it (step 10):

Replace 3 credits and 2.67 with 3 credits and 3.0

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

+organizations promote and otherwise market themselves?

Answered: 1 week ago