Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***Write a program that calculates the effect that various possible grades in CS2011 will have on the user's GPA*** USING JAVA 1) Use Console input

***Write a program that calculates the effect that various possible grades in CS2011 will have on the user's GPA*** USING JAVA

1) Use Console input to ask the user for his or her present GPA and the number of total units he or she has taken. Cast these to a double and an Integer. Validate for both input format and numeric range. For example, the input for GPA must be parseable to a a double between 0 and 4.0.

2) For simplicity, you may assume the user is not taking any other classes this term.

3) Note that CS2011 is a 3 unit class. Use a variable or constant for this value so that you could easily change it if you wanted to apply this program to another class.

4) The new GPA is calculated this way: ((present GPA * existing units) + (new units * grade)) / (existing units + new units).

5) Use a loop to find the effect on the student's GPA for each possible grade in CS2011. A corresponds to 4 grade points, A- to 3.7, B+ to 3.3, B to 3, B- to 2.7, C+ to 2.3, and C to 2.0. Do not use the letter grades, only the numeric values. Use a while or do...while loop containing if/else code that decrements the grade by 0.3 if it was 4.0, 3.3, 3.0, or 2.3 or decrements it by 0.4 if it was 3.7 or 2.7.

6) You will need to use Math.abs() in the loop test. Due to the imprecision of floating point types, you will not get correct results if you simply test whether a grade is, for example, equal to 3.0. See lecture 5.

7) Think carefully about the test in the while or do...while loop. The loop should break after the output is shown for a grade that is near 2.0, which is a double.

8) For each possible grade, show the grade, the new GPA, and the change between the old and new GPAs. Use printf() to show the numeric values to two places after the decimal point

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

Logic In Databases International Workshop Lid 96 San Miniato Italy July 1 2 1996 Proceedings Lncs 1154

Authors: Dino Pedreschi ,Carlo Zaniolo

1st Edition

3540618147, 978-3540618140

More Books

Students also viewed these Databases questions

Question

Describe the job youd like to be doing five years from now.

Answered: 1 week ago

Question

So what disadvantages have you witnessed? (specific)

Answered: 1 week ago