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

C++ Inheritance / Bank Account MAIN.CPP ACCOUNT.CPP ACCOUNT.H CERTIFICATE_OF_DEP

ID: 664951 • Letter: C

Question

C++ Inheritance / Bank Account

MAIN.CPP

ACCOUNT.CPP

ACCOUNT.H

CERTIFICATE_OF_DEPOSIT.CPP

CERTIFICATE_OF_DEPOSIT.H

CHECKING_ACCOUNT.CPP

CHECKING_ACCOUNT.H

SAVINGS_ACCOUNT.CPP

SAVINGS_ACCOUNT.H

**For checking accounts: Can withdrawl/ deposit money normally...Do not gain interest**

**Savings accounts: Can withdrawl/ deposit nomrally....Gain 1% interest if they have $100.00 - 999.99.....Gain 2% interest if they have $1000.00 or more**

** Certificate of Deposits: Can deposit normally......tracks if money has been withdrawn.....Gain 10% interest if they haven't been withdrawn...Gain 1% interst if they have been withdrawn**

Explanation / Answer

For checking accounts: Can withdrawl/ deposit money normally...Do not gain interest

As per above code.if withdraw money then balance will be decrease and if deposit balance will be increase.here interest applicable only on balance.not depend on withdraw or deposit.

Void Account : deposit(double amount)

{

balance = balance+Amount;

}

Void Account : Withdraw(double amount)

{

balance = balance - Amount;

}

Savings accounts: Can withdrawl/ deposit nomrally....Gain 1% interest if they have $100.00 - 999.99.....Gain 2% interest if they have $1000.00 or more**

Void SavingAccount : Interest90

{

if(balance >= 100.00 && balance <= 1000.00)

     {

         balance = balance * 1.01;

      }

else

   if (balance > 1000.00)

    {

       balance = balance * 1.02;

   }

}

Certificate of Deposits: Can deposit normally......tracks if money has been withdrawn.....Gain 10% interest if they haven't been withdrawn...Gain 1% interst if they have been withdrawn**

void CheckingAccount :: accrueInterest()

{

   if (haswithdrawn = = 0)

   {

      balance = balance * 1.10;

}

else

{

    balance = balance * 1.01;

}

}

Full code

#include <iostream.h>
#include <conio.h>

class account
{
char cust_name[20];
int acc_no;
char acc_type[20];
public:
   void get_Account_info()
   {
       cout<<" Enter Customer Name :- ";
       cin>>cust_name;
       cout<<"Enter Account Number :- ";
       cin>>acc_no;
       cout<<"Enter Account Type :- ";
       cin>>acc_type;
   }
   void display_Account_info()
   {
       cout<<" Customer Name :- "<<cust_name;
       cout<<" Account Number :- "<<acc_no;
       cout<<" Account Type :- "<<acc_type;
   }
};

class cur_acct : public account
{
staticfloat balance;
public:
    void disp_currbal()
    {
      cout<<" Balance :- "<<balance;
    }
    void deposit_currbal()
    {
      float deposit;
      cout<<" Enter amount to Deposit :- ";
      cin>>deposit;
      balance = balance + deposit;
    }
    void withd
    raw_currbal()
    {
      float penalty,withdraw;
      cout<<" Balance :- "<<balance;
      cout<<" Enter amount to be withdraw :-";
      cin>>withdraw;
      balance=balance-withdraw;
      }
};

class sav_acct : public account
{
staticfloat Balance;
public:
     void disp_Balance()
    {
      cout<<" Balance :- "<<Balance;
    }
    void deposit_Balance()
    {
      float deposit,interest;
      cout<<" Enter amount to Deposit :- ";
      cin>>deposit;
      Balance = Balance + deposit;
        if (Balance >= 100.00 && Balance <= 1000.00)
        {
         interest=(Balance*1)/100;
         Balance=Balance+interest;
         }
         else
          if (Balance > 1000.00)
          {
             interest=(Balance*2)/100;
             Balance=Balance+interest;
         }
    
    }
    }
    void withdraw_Balance()
    {
      float withdraw;
      cout<<" Balance :- "<<Balance;
      cout<<" Enter amount to be withdraw :-";
      cin>>withdraw;
      Balance=Balance-withdraw;
      if(withdraw > Balance)
      {
      cout<<" You have to take permission for Bank Overdraft Facility ";
      Balance=Balance+withdraw;
      }
      else
      cout<<" After Withdrawl your Balance revels : "<<Balance;
     }
    
      void cerificate_deposit()
        {
           Bool haswithdraw;
            if (haswithdrawn = = 0)

   {

      balance = balance * 1.10;

}

else

{

    balance = balance * 1.01;

}
cout<<" After Withdrawl your Balance revels : "<<Balance;
};


float cur_acct :: balance;
float sav_acct :: Balance;


void main()
{
clrscr();
cur_acct c1;
sav_acct s1;

cout<<" Enter S for saving customer and C for current a/c customer ";
char type;
cin>>type;

int choice;

   if(type=='s' || type=='S')
     {
       s1.get_Account_info();
       while(1)
       {
     clrscr();
     cout<<" Choose Your Choice ";
     cout<<"1)   Deposit ";
     cout<<"2)   Withdraw ";
     cout<<"3)   Display Balance ";
     cout<<"4)   Display with full Details ";
     cout<<"5)   Deposit certificate ";
     cout<<"6)   Exit ";
     cout<<"7)   Choose Your choice:-";
     cin>>choice;
     switch(choice)
     {
       case 1 : s1.deposit_Balance();
            getch();
            break;
       case 2 : s1.withdraw_Balance();
            getch();
            break;
       case 3 : s1.disp_Balance();
            getch();
            break;
       case 4 : s1.display_Account_info();
            s1.disp_Balance();
            getch();
            break;
       case 5: s1.cerificate_deposit90;
               getch();
               break;
       case 6 : goto end;
       default: cout<<" Entered choice is invalid,"TRY AGAIN"";
     }
       }
     }
    else
     {
       {
       c1.get_Account_info();
       while(1)
       {
     cout<<" Choose Your Choice ";
     cout<<"1)   Deposit ";
     cout<<"2)   Withdraw ";
     cout<<"3)   Display Balance ";
     cout<<"4)   Display with full Details ";
     cout<<"5)   Deposit certificate ";
     cout<<"6)   Exit ";
     cout<<"7)   Choose Your choice:-";
     cin>>choice;
     switch(choice)
     {
       case 1 : c1.deposit_currbal();
            getch();
            break;
       case 2 : c1.withdraw_currbal();
            getch();
            break;
       case 3 : c1.disp_currbal();
            getch();
            break;
       case 4 : c1.display_Account_info();
            c1.disp_currbal();
            getch();
            break;
       case 5: s1.cerificate_deposit90;
           getch();
               break;
       case 6 : goto end;
       default: cout<<" Entered choice is invalid";
     }
       }
     }
end:
}
}