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

Write a C++ program similar to the ones used in ATM machines. Essentially your p

ID: 3691610 • Letter: W

Question

Write a C++ program similar to the ones used in ATM machines. Essentially your program is to handle a person's savings and checking accounts and should handle the following services: Transfer from savings account to checking account Transfer form checking account to savings account Cash withdrawal from either account Balance statements for both the accounts Assume that the ATM machine recognizes a unique 3-digit personal identification number (PIN). In your initial screen you are to first ask the user to type in his/her PIN as follows: *** Welcome to ATM **** Please enter your PIN: In response to this, the user has to enter a valid PIN. Assume that the only legal PIN is: 111 If any number besides this PIN is entered, the screen is to be cleared and the same screen to be redisplayed. The user then gets a second chance to enter a valid PIN. If an illegal PIN is entered three consecutive, the following message: Too many illegal PINs. Try later again. should appear on the screen and your program must terminate. If the entered PIN is a legal value,

the main menu is to be displayed as follows:

*** Welcome To ATM System ***

(1) Transfer from checking account to savings account

(2)Transfer from savings account to checking account

(3) Savings account balance

(4) Checking account balance

(5) Withdraw Cash from either account

(6) Exit ==> Please select option (1-6):

The following are some of the guidelines you should follow: -- The main menu is to continue to be displayed until user selects option 6. At this point a message such as Thank you for using the ATM system. should appear and your program execution is to be terminated. -- Users have to select options 1, 2, 3, 4, 5 or 6. Redisplay the menu if any number outside the range 1 to 6 is entered (Hint: Use system("cls") command from library to clear the screen) -- Withdrawl (selection 5) should ask wether the user wants to withdraw from checking account or saving account and should subtract the amount specified from the appropriate account. -- Savings and checking accounts both have initial balance of $1000.00 -- Any transfer is allowed only if it can be honored. For example, if the savings account balance is $500.00 and the user requests to transfer $550.00 from that savings account to the checking account an appropriate message such as "Transasction not completed" should be displayed and the current balance of that account should be printed. The screen is to be cleared and the main menu to be displayed. -- Use functions to accomplish various tasks in the menu

Explanation / Answer


#include<iostream.h>

double SavingsBalance = 10000, CheckingBalance = 20000;
double withdraw, transaction = 0;


int main()

{

int password;

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

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

if (password==111)
{
cout<<"Bank Name ";
int option;
cout<<" ";
cout<<" ***Bank Name*** ";
  
cout<<"Choose a Transaction: ";
cout<<" ";
cout<<"(1) Transfer from checking account to savings account "
<<"(2) Transfer from savings account to checking account "
<<"(3) Savings account balance "
<<"(4) Checking account balance "
<<"(5) Withdraw Cash from either account "
   <<"(6) Exit "
<<" "
<<"Please select option (1-6):";
cin>>option;

switch(option)
{
case 1:
cout<<" [[[Transfer from Savings Account to Checking Account]]] ";
cout<<"Enter amount to be Transfer: $";
cin>>transaction;
SavesToCheck(transaction);
continue;
case 2:
cout<<" [[[Transfer from Checking Account to Savings Account]]] ";
cout<<"Enter amount to be Transfer: $";
cin>>transaction;
CheckToSaves(transaction);
continue;
case 3:
cout<<" [[[Savings Account BALANCE INQUIRY]]] ";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<" Your current balance is $"<<SavingsBalance<<endl;
break;
case 4:
cout<<" [[[Checking Account BALANCE INQUIRY]]] ";
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout<<" Your current balance is $"<<CheckingBalance<<endl;
break;
case 5:
char choice;
cout<<"Choose the Account you want to withdraw Amount from Savings(Press 'S') Or Checking(Press 'C') "
cin >>choice;
if( choice == "s" || choice == "S"){
cout<<" [[[WITHDRAW from Savings Account]]] ";
cout<<"Enter amount: $";
cin>>withdraw;
  
if(withdraw <= Savingsbalance){
SavingsBalance = SavingsBalance - withdraw;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
   cout.precision(2);

cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<SavingsBalance<<endl;
}
else
cout<<" Your current Balance is: "<<SavingsBalance<<endl;
}
if( choice == "C" || choice == "c"){
cout<<" [[[WITHDRAW from Checking Account]]] ";
cout<<"Enter amount: $";
cin>>withdraw;
  
if(withdraw <= CheckingBalance){
Checkingbalance = CheckingBalance - withdraw;
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
   cout.precision(2);

cout<<"You withdrew $"<<withdraw<<endl;
cout<<"Your remaining balance is $"<<CheckingBalance<<endl;
}
else
cout<<" Your current Balance is: "<<CheckingBalance<<endl;
}
continue;

case 6:
cout<<" ***Thank You*** ";

break;


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

break;
}
else


cout<<"Transaction Not Completed Pls try again!!! ";}

return 0;
}

void SavesToCheck(double transaction)
{

if(transaction <= SavingsBalance){
CheckingBalance = CheckingBalance + transaction;
SavingsBalance = SavingsBalance - transaction;   
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
}
else
cout<<" Your Current Balance is "<<SavingsBalance<<endl;
cout<<"You Transfered amount $"<<transaction<<endl;
cout<<"Your new balance in Checking Account is $"<<CheckingBalance<<endl;
cout<<"Your new balance in Savings Account is $"<<SavingsBalance<<endl;

}
void CheckToSaves(double transaction)
{
if(transaction <= CheckingBalance){
SavingsBalance = SavingsBalance + transaction;
CheckingBalance = CheckingBalance - transaction;   
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
}
else
cout<<" Your Current Balance is "<<SavingsBalance<<endl;
cout<<"You Transfered amount $"<<transaction<<endl;
cout<<"Your new balance in Checking Account is $"<<CheckingBalance<<endl;
cout<<"Your new balance in Savings Account is $"<<SavingsBalance<<endl;

}

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