Ultra LTE 1231 PM rite a C program to do the following 1 Dec

Ultra LTE 12:31 PM rite a C++ program to do the following: 1. Declare global variable called accountBalance of type double 2. The Main program should ask the user for their name and account number and display the following choices: 1. Press i for Withdrawal 2. Press 2 for Deposit 3. Press 3 for Balance Inquiry 4. Press 4 to quit 3. If the user chooses 1, input the withdrawal amount from the user and call the function called accountWithdrawal with this amount. This function updates the balance with the amount withdrawn. 4. If the user chooses 2, input the deposit amount from the user and call the function called accountDeposit with this amount. The function updates the balance with the amount deposited. 5. If the user chooses 3, call the function called accountInquiry that returns the current balance on the account 6. If the user chooses 4, exit from the program PLEASE solve this using only switch case, MUST use WHILE loop, you can use string function. Also please take care of the situation where money goes overdraft ) show that option in Text Submission

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   

*/


Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site