Last Modified 12/17/2008 Key Concept: do...while loop, nestingstructures, previe
ID: 3609342 • Letter: L
Question
Last Modified 12/17/2008
Key Concept: do...while loop, nestingstructures, preview of methods
Write a program that handles many transactions at an ATM.
Start with a default balance of your choosing (i.e. how much wasin the user's account). Use a CONSTANT for this and declare itglobally.
Present the user with a menu that looks like this:
Use a switchstructure to implement the menu.
If the user asks to withdraw or deposit, ask for an amount andoutput a new balance. You'll need to keep track of the balancebetween transactions in doing so.
You should treat lowercase options as valid, but you should alsoprint out an error message for an invalid options.
You don't need to worry about formatting the number of decimalsin the output.
The menu should run constantly until the user selects the 'Q'option. Use a do...while loop.
You may have noticed that the code in your main program is starting to getlong. We're going to make a first step in the direction ofshortening it. What we're going to do is move the output statementsthat print out the menu outside of main. Follow these directionsvery carefully:
Explanation / Answer
please rate - thanks part 1 #include using namespace std; #define BALANCE 397.66 int main() {char choice; double balance, amount; balance=BALANCE; do{ coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.