Please need help for homework.

May 11th, 2015
DreamIt
Category:
Programming
Price: $10 USD

Question description

HW Question

 For this assignment, you are required to write a C++ program that simulates an ATM.

 A customer should be able to  deposit to the account,

·  withdraw from the account, and

·  print the current balance.

· The customer may choose to do these transactions in any order and as many times as he/she would like to. The program should end only when the user wants to quit. The details are as follows:

 Deposit: The customer adds a certain amount to the account balance. Your program must· ask the customer how much to deposit. Notice that a customer cannot deposit a negative amount or 0 dollars. Your program must keep asking for the proper amount until the user enters one. Once the transaction is complete, the current balance should be displayed.

 Withdraw: The customer subtracts a certain amount from the account balance. Your· program must ask the customer how much to withdraw. Note that a customer is not allowed to remove more than the current balance or a negative amount. Your program must keep asking for the proper amount until the user enters one. Once the transaction is complete, the current balance should be displayed.

 Get Current Balance: The customer's current balance is printed. Assume that the· customer initially has $5000.00 in his/her account. 

Menu Options:· The user should enter the letter: 

*(D) or (d) to make a deposit,

*  (W) or (w) to make a withdrawal,

* (B) or (b) to view the current balance, and

*  (Q) or (q) to quit.

*  If the user enters another letter, your program should present the user his/her options

 again and ask for a proper command. 

Functions:

1.  You will write one function called print_menu() for displaying the following text and call it whenever necessary: “Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.” // Note that this function will consist of a cout command only.

 2. You will write another function called print_balance() for displaying the current balance and call it from the main() program whenever the balance needs to be printed.

 Here is an example of the running program:

Welcome!

 Your current balance is 5000.00 dollars. Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

 C

Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

 D

Please enter the amount you'd like to deposit:

 150.00

 Your transaction is complete. Your current balance is 5150.00 dollars. Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

d

 Please enter the amount you'd like to deposit:

 -25.00

 Please enter a proper amount:

-50.00

 Please enter a proper amount:

 50.00

Your transaction is complete. Your current balance is 5200.00 dollars. Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

W

 Please enter the amount you'd like to withdraw:

-100.00

 Please enter a proper amount:

 10000.00

 Please enter a proper amount:

-100.00

 Please enter a proper amount

: 100.00

Your transaction is complete. Your current balance is 5100.00 dollars. Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

 B

 Your current balance is 5100.00 dollars. Here are your options: Enter (D) or (d) to make a deposit, (W) or (w) to make a withdrawal, (B) or (b) to view the current balance and (Q) or (q) to quit.

Q.


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: Cornell University
PREMIUM TUTOR

Studypool has helped 1,244,100 students

5 Reviews


Summary
Quality
Communication
On Time
Value
ashleyisgod
Nov 23rd, 2016
" Top quality work from this guy! I'll be back! "
Molly_Moon
Nov 1st, 2016
" AMAZING as always! "
Hemapathy
Oct 9th, 2016
" all I can say is wow very fast work, great work thanks "
BlueOcean
Sep 26th, 2016
" Awesome! Exactly what I wanted. "
kevin12622
Sep 17th, 2016
" Goes above and beyond expectations ! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1827 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors