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

  1. Prompt user for an opening balance, credits, and debits.
  2. Output the new balance
  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!