Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions