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

Starting C++ Write a program that simulates a rather simple ATM machine. The pro

ID: 3673155 • Letter: S

Question

Starting C++

Write a program that simulates a rather simple ATM machine. The program prompts a customer for transaction code: • 1- withdrawal • 2- deposit • 3-check balance, or • 4-exit The program should prompt the user for the initial amount in the account. The person should not be able to withdrawal more than is in the account. If the person withdrawals money, the program should print out the initial amount minus the withdrawal amount and the new balance in the account. If they deposit money, the program should print out the initial amount plus the deposit amount and the new balance in the account. If the person wants to check balance, then the program should print out balance in the account.

Explanation / Answer

METHOD 1:


#include <iostream>
using namespace std;

int main()

{

int password;

for (int i=0;i<3;i++)

{cout <<"enter password: ";
cin>>password;

if (password==123456)
{cout<<"korek!!! ";

double balance = 3230;
double withdraw, deposit;
int option;
cout<<" ";
cout<<" ***MOGOL*** ";
cout<<"*** Automated Teller Machine***"<<endl;
cout<<"Choose a Transaction: ";
cout<<" ";
cout<<"[1] Inquire Balance "
<<"[2] Withdraw "
<<"[3] Deposit "
<<"[4] Quit "
<<" "
<<"Enter Option:";
cin>>option;

switch(option)
{
case 1:
cout<<" [[[BALANCE INQUIRY]]] ";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<" Your current balance is $"<<balance<<endl;
break;
case 2:
cout<<" [[[WITHDRAW]]] ";
cout<<"Enter amount: $";
cin>>withdraw;

balance = balance - withdraw;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<balance<<endl;
continue;
case 3:
cout<<" [[[DEPOSIT]]] ";
cout<<"Enter amount: $";
cin>>deposit;

balance = balance + deposit;

cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);

cout<<"You deposited $"<<deposit<<endl;
cout<<"Your new balance is $"<<balance<<endl;
continue;
case 4:
cout<<" ***[[[EXIT MODE]]]*** ";

break;


default:
cout<<" That is an invalid option ";
}

break;
}
else


cout<<"Pls try again!!! ";
}

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote