Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this Lab you will create, in a file named LabCh03ATM1.java, our first simple simulation of an Automated Teller Machine (ATM). This program will do

image text in transcribed
In this Lab you will create, in a file named LabCh03ATM1.java, our first simple simulation of an Automated Teller Machine (ATM). This program will do one transaction each time it is executed, as described below. Assume that the user's starting balance is $1000, and PIN is 3891. Here is the desired behavior for the program Ask the user to enter their PIN. If the PIN is not correct, print a rude message and halt the program (to halt a program, you can do this method call: System.exit (o); Then (assuming the program is still running!), display this little menu: 1: deposit 2: withdraw 3: inquiry and ask the user to enter their transaction choice, which should be an int value. Next, perform the requested transaction, as follows (be sure to use a mult-case statement to process the various requests) If the user entered 1, ask for the amount (as a double value) to be deposited to their account. If the amount entered is negative or zero, print an appro- priate message and halt the program. Otherwise, add the amount to the balance and display the new balance. If the user entered 2, ask for the amount to be withdrawn. If the amount is not a multiple of 20, or is not positive, or is greater than the user's balance, print an appropriate message- different for each case-and halt the program. Otherwise, subtract the amount from the balance, display the new balance, and, to simulate dispensing the money, print a message saying how many $20 bills were dispensed. If the user entered 3, simply display the balance. If the user entered any number other than 1, 2, or 3, print an appropriate message and halt This program is complicated enough to have a lot of test cases-be sure that you test your program for every feature, including all the errors the user can make. Once you are satisfied, have someone else try to find flaws in your work

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

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions