Question: Write a program that will: 1) Declare a real number constant and assign it a value of 7.39. 2) Prompt the user for a real
Write a program that will:
1) Declare a real number constant and assign it a value of 7.39.
2) Prompt the user for a real number that has exactly two digits past the decimal place. (You may assume that if you prompt the user informatively, they will follow your instructions!)
3) Separate the input into a whole number part and a fractional part, keeping both values as separate integers, called wholeNumberPart and fractionNumberPart.
4) Then increment wholeNumberPart by one using the increment operator.
5) Then change the wholeNumberPart by obtaining the remainder when wholeNumberPart is divided by 17. Use the augmented assignment operator.
6) Then calculate a real number by adding the wholeNumberPart to the fractionNumberPart (which are integers) and then multiplying by the constant created earlier.
7) Display the result in a meaningful way.
Note: The class name should be NumberScramble.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
