Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a C++ Program that simulates an ATM Machine. The program should include a

ID: 3560647 • Letter: C

Question

Create a C++ Program that simulates an ATM Machine.

The program should include all of the following.

1. At least one struct or class

2. At least four user-defined (member or non-member) functions

3. A Vector

4. 'static' variable or function overloading

5. File I/O

Explanation / Answer

#include void deposite(); void withdraw(); char line[256]; // line used for input int main() { int choice, a; float money,m; printf("Student ID : TATA_12345 "); printf("NAME : RATAN TATA "); printf("(1) DEPOSITE MONEY "); printf("(2) WITHDRAW MONEY "); printf("(3) FIND THE ACCOUNT BALANCE "); printf("Enter your choice : "); fgets(line, sizeof(line), stdin); sscanf(line, "%d", &choice); switch (choice) { case 1: deposite(); /*to deposite money*/ break; case 2: withdraw(); /*to withdraw money*/ break; case 3: /*to see the balance*/ printf(" This facility is not currently available "); break; default: /*if choice is not valid*/ printf("ERROR// PLEASE TRY AGAIN"); return 0; } printf("Press any key to continue..."); getchar(); return 0; } void deposite() { float money; printf(" Enter the amount of money to be deposited(dollars.cents):"); fgets(line, sizeof(line), stdin); sscanf(line, "%f", &money); if(money>0) { printf(" $%.2f has been deposited in your account ", money); } else printf(" Please enter valid amount....... "); } void withdraw() { long int rem,f,t,e; long int mon; printf("Enter the amount of money to be withdrawn: "); fgets(line, sizeof(line), stdin); sscanf(line, "%ld", &mon); if(mon>=20) { if(mon!=30) { f=mon/50; /*decides the notes of $50*/ rem=mon%50; if(rem!=20) { if (rem==10||rem==30) { f-=1; rem+=50; } } t=rem/20; /*decides the notes of $20*/ e=rem%20; if(e==0) { printf(" Nos. of 50$ note : %.2ld ", f); printf("Nos. of 20$ note : %.2ld ", t); printf("TOTAL AMOUNT : %.2ld ", mon); } else { printf(" This amount is not possible... Please try again "); } } else /*if amount is not possible*/ { printf(" This amount is not possible... Please try again "); } } else { printf(" This amount is not possible... Please try again "); } }