Question: In Java Please Deposit Check Loop CS205 Description This program will process bank account checks and prevent a negative balance. Requirements First, get the initial

In Java Please

In Java Please Deposit Check Loop CS205 Description This program will process

Deposit Check Loop CS205 Description This program will process bank account checks and prevent a negative balance. Requirements First, get the initial account balance from the user. Second, use a while loop to continually allow the user to enters checks until a negative number such as a -1 is entered for the check (note: Other negative numbers such as-2, -999, -0.5, etc. should also terminate the loop.) Do not let this sentinel value influence your balance. Implement a simple form of error catching within the loop: If a check were to make the balance go negative (bounce), prevent the check from being deducted from the balance. Instead, display the following message: Warning: Check will bounce. No transaction occurred. Note: You may not subtract the check from the balance and then add it back in if a negative balance occurs; the balance must always be >= 0. Finally, display the remaining balance after the loop has terminated. Match the prompts and the output shown in the sample runs below. Use the Decimal format class as shown in the notes to properly display the balance with a $, commas if necessary, and 2 digits of precision. Follow all coding guidelines, except the only documentation required is your name above the class. Submission Upload.java files to Canvas Sample Runs Run #1 Please enter a balance: $500 Please enter check amount (-1 to end): $350 Remaining balance: $150.00 Please enter check amount (-1 to end): $50.50 Remaining balance: $99.50 Please enter check amount (-1 to end): $100 Warning: Check will bounce. No transaction occurred. Please enter check amount (-1 to end): $49.50 Remaining balance: $50.00 Please enter check amount (-1 to end): $-1 Final balance: $50.00 Run #2 Please enter a balance: $2000 Please enter check amount (-1 to end): $1250 Remaining balance: $750.00 Please enter check amount (-1 to end): $1.50 Remaining balance: $748.50 Any negative number will terminate the check entry loop - not just - 1 Please enter check amount (-1 to end): $-999 Final balance: $748.50 Run #3 Please enter a balance: $500 Notice that the while loop body is never executed if the user enters the balance, but then decides not to process any checks. (e.g. Remaining balance does not also appear) Please enter check amount (-1 to end): $-1 Final balance: $500.00

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!