Question
Write a complete Java program called AtmSimDoLoop (without the quotation marks) according to the following specifications. It should use a do-while loop to prompt the
Write a complete Java program called "AtmSimDoLoop" (without the quotation marks) according to the following specifications. It should use a do-while loop to prompt the user with the following starting prompt (without the horizontal lines) until the user enters 4 to quit.
The program should start with an initial account balance, which you can set to any legitimate double value. Prompt the user with the following prompt (without the horizontal lines).
Enter the number of your desired transaction type.
Deposit
Withdrawal
Balance
Quit
If a balance is requested, the program should output Your current balance is $X. where X is the current balance, and repeat the 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 new balance is $X. where X is the new balance after the deposit, and repeat the 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 current balance, print Your new balance is $X. where X is the new balance after the withdrawal, and then repeat the prompt for the user. If the proposed withdrawal amount exceeds the current balance, print Transaction cannot be completed because there are insufficient funds. Your current balance is $X. where X is the currrent balance, and then repeat the prompt for the user.
If Quit is requested, the program should print Thank you. Have a wonderful day! and then stop.
All balances should be printed to two decimal places.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started