Write a complete Java program called AtmSimDoLoop that simulates a simple ATM....

Write a complete Java program called AtmSimDoLoop that simulates a simple ATM according to the following guidelines.

The program should start with an initial account balance, which you can set to any legitimate double value. It should use a do loop to prompt the user with the following starting prompt (without the dashed lines) until the user enters 4 to quit.

Enter the number of your desired transaction type.

1.       Balance

2.       Deposit

3.       Withdrawal

4.       Quit

·         If a balance is requested, the program should output “Your current balance is X.” where X is the current balance (including updates if other transactions have been made), and then repeat the starting prompt for the user.

·         If a deposit is requested, prompt the user to enter the amount of the deposit (use a double for this). Add the deposit amount to the current balance and then print “Your current balance is X.” where X is the new balance after the deposit, and then repeat the starting prompt for the user.

·         If a withdrawal is requested, prompt the user to enter the amount of the withdrawal (use a double for this). If the proposed withdrawal amount is less than or equal to the initial balance,  print “Your current balance is X.” where X is the new balance after the withdrawal, and then repeat the starting prompt for the user. If the proposed withdrawal amount exceeds the current balance, print “Insufficient funds. Your current balance is X.” where X is the current balance before the attempted withdrawal, and then repeat the starting prompt for the user.

·         If “Quit” is requested, the program should print “Good-bye.” and then stop.

Thoughts

·         Note that you need to keep track of the current balance during each iteration of the loop.

·         Before you begin coding, sketch out the logic that will handle each condition appropriately.

·         Note that this simple ATM simulator handles, for simplicity, just a single transaction of Balance, Deposit, or Withdrawal
Powered by