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

Must use pointers. C++ program Instructions: Create a program that prompts the u

ID: 3755999 • Letter: M

Question

Must use pointers. C++ program

Instructions:

Create a program that prompts the user which bank account to access. The user will have an option to access a temporary account, and one that is not temporary. The temporary account will be created as a dynamic variable, the other with an automatic variable.

Prompt the user:

• What account do you want to access? Personal or Temporary?

• Once they select an account, prompt if they want to withdraw or deposit money

• Do you want to view your balance?

• Output Balance

Give the user a menu that will allow them to select from the menu above.

Suggested (you may use your own) Function Prototypes:

void Deposit(double *account, doublebalance);

precondition: account has been created

poscondition: user can deposit money into this account.

void Withdraw( double *account, doubleamount);

precondition: account has been created

postconditon: user can withdraw money

Explanation / Answer

#include<iostream.h>

#include<conio.h>

#include<stdlib.h>

class bank {

static reset;

float balance, amount, shorta;

public:

void deposit();

void withdraw();

void chkbalance();

int menu();

};

int bank::reset=0;

void bank::deposit(double *acntnumber, double amount)

{

balance=balance+amount;

cout<<" Message: You have successfully deposited Rs."<<amount<<" into your account. Your Current Balance is:"<<balance<<" ";

reset++;

}

void bank::withdraw(double *acntnumber, double amount) {

if(amount>balance)

{

shorta=amount-balance;

cout<<" You cannot withdraw Rs."<<amount<<" as your account balance is Rs."<<balance<<" You are short of Rs."<<shorta;

}

else

{

balance=balance-amount;

cout<<"You have Withdrawn Rs."<<amount<<" Successfully Your account balance is:"<<balance<<" ";

}

}

void bank::chkbalance(double *acntnumber) {

if(reset==0)

{

balance=0;

}

cout<<"Your Account balance is Rs."<<balance<<" ";

}

void main()

{

bank ob;

int ch,acnt;

double dep,wtdraw;

double *acntno;

clrscr();

do {

cout<<"What Account do yopu want to access? 1.Personal 2.Temporary";

cin>>acnt;

cout<<"Enter Account Number";

cin>>acntno;

if(acnt==1 || acnt==2)

{

cout<<" 1.Deposit 2.Withdraw 3.Balance Enquiry 4.Exit ";

ch=ob.menu();

switch(ch)

{

case 1:cout<<"Entyer amount for deposit";

cin>>dep;

ob.deposit(acntno,dep);

break;

case 2:cout<<"Entyer amount for withdrawal";

cin>>wtdraw;

ob.withdraw(acntno,wtdraw);

break;

case 3:ob.chkbalance(acntno);

break;

case 4: exit(1);

default:cout<<"Invalid Choice!!";

}

}

}while(1);

}

int bank::menu()

{

int ch;

cout<<" Enter your Choice:";

cin>>ch;

return ch;

}