Ultra LTE 1231 PM rite a C program to do the following 1 Dec
Solution
/******************************************************************************
C++ program for ATM System and Its Operations
*******************************************************************************/
#include <iostream>
using namespace std;//use libraty of c++
double balance=10000; //declaring globale balance=10000 amount;
int balaceWithdrow(double); // declaring all function
int balaceDiposite(double);
int balaceInquiry(double);
int main()
{
char name[50]; ///declaring char[] string t
char c;
int accNumber,ch;
cout<<\"Enter your Name= \";//asking user for enter name
cin>>name;
cout<<\"Enter your Acount Number= \"; //asking user for enter acc Number
cin>>accNumber;
do{
cout<<\"Press 1 for witdrawal\ \";
cout<<\"Press 2 for Diposite\ \"; // create user interface
cout<<\"Press 3 for Balance Inquiry\ \";
cout<<\"Press 4 for Exit\ \";
cin>>ch;
switch(ch){ //take user choice in switch
case 1:
balaceWithdrow(balance);
break;
case 2:
balaceDiposite(balance);
break;
case 3:
balaceInquiry(balance);
break;
case 4:
//case 4 for exit from system
exit(0);
default:
// default case for is user enter wrong Input
cout<<\"Wrong Input please Enter Correct Input\";
break;
}
cout<<\"\ Press Y || y to continue= \";// asking user for more operation if he wants
cin>>c;
}while(c==\'y\'||c==\'Y\');
return 0;
}
int balaceWithdrow(double balace){ //function for withdraw amount
int withdraw;
cout<<\"Enter amount for withdraw=\";// asking user for enter amount to withdraw
cin>>withdraw;
while(balance<withdraw){ //check balance is Sufficient to Transation if not show message
cout<<\"\ Not Sufficient Balance To withdraw please enter amount less than=\"<<balance;
break; // use to break current operation
}
if(balance>=withdraw){
balance=balance-withdraw;// if balace is Sufficient withdraw and update balance
cout<<\"\ Remainig balance after transation=\"<<balance; // show nRemainig balance to use
}
cout<<\"\ Thank You For Transaction...!\";
}
int balaceDiposite(double balace){ // function for diposite amount
int diposite;
cout<<\"Enter amount for Diposite=\"; // case 2 asking user for enter amount to diposite
cin>>diposite;
balance=balance+diposite; // adding diposited amount int balance update balance
cout<<\"\ Balance After Diposite= \"<<balance; // show balance after Depposite
cout<<\"\ Thank You For Transaction...!\";
}
int balaceInquiry(double balance){ //function for Balance inquiry
cout<<\" Your Balance is Balance=\"<<balance; // case 3 show balace to user directally
cout<<\"\ Thank You For Transaction...!\";
}
/*
output
Enter your Name= abc
Enter your Acount Number= 1234567
Press 1 for witdrawal
Press 2 for Diposite
Press 3 for Balance Inquiry
Press 4 for Exit
3
Your Balance is Balance=10000
Thank You For Transaction...!
Press Y || y to continue= y
Press 1 for witdrawal
Press 2 for Diposite
Press 3 for Balance Inquiry
Press 4 for Exit
1
Enter amount for withdraw=8000
Remainig balance after transation=2000
Thank You For Transaction...!
Press Y || y to continue= y
Press 1 for witdrawal
Press 2 for Diposite
Press 3 for Balance Inquiry
Press 4 for Exit
1
Enter amount for withdraw=3000
No Sufficient Balance To withdraw please Depposite first for furthur Transation
Press Y || y to continue= y
Press 1 for witdrawal
Press 2 for Diposite
Press 3 for Balance Inquiry
Press 4 for Exit
4
*/