Question: Java Ex: If the input is: 100 200 50 n the output is: Enter a starting balance Enter credits Enter debits Your new balance is:
Java
Ex: If the input is:
100 200 50 n
the output is:
Enter a starting balance Enter credits Enter debits Your new balance is: 250.00 Continue?: y / n
REQUIREMENTS
- Prompt user for an opening balance, credits, and debits.
- Output the new balance
- The user should be prompted to enter new credits and debits until they indicate the are ready to exit the program
Note:
Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue);
Hints:
You have to store dollars and cents, so think about what variable types you'll be using for beginning balance, debits and credits A while loop will prompt the user to enter debits and credits until the user enters a "n". You'll need to prompt the user for a single character (y or n). This is how you do it: userChar = scnr.next().charAt(0);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
