Question
JAVA Program The goal of this program is to create an ATM interface. Create a new class with a global variable of type double named
JAVA Program
The goal of this program is to create an ATM interface.
Create a new class with a global variable of type double named balance.
Implement four ATM menu options:
1.Deposit - Increases the balance accordingly
2.Withdraw - Decreases the balance accordingly.
3.Show balance - Prints the balance to the user
4.Exit - Ends the ATM program
The functionality of all of these options, except for Exit, should be contained within a method.
The ATM should first welcome the user and display the input options. In order to specify an option, use Scanner to allow the user to enter the numbers 1, 2, 3, or 4, corresponding to the options Deposit, Withdraw, Show balance, and Exit, respectively.
The ATM should continue to prompt the user for an option (in the main) until the user decides to Exit (4) the ATM. If the user chooses 1 or 2, the ATM should prompt the user to input an amount to deposit or withdraw. If the user attempts to withdraw more money than they have, do not withdraw the money and instead print an error message.
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