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

Create one subclass as CDAccount. You will add two private variables, duration (

ID: 3679437 • Letter: C

Question

Create one subclass as CDAccount. You will add two private
variables, duration (in months) and CDannualInterestRate,
and four member functions, getDuration(), setDuration(),
getCDannualInterestRate(), and
setCDannualInterestRate().
Every three months CD duration will increase the
CDannualInterestRate by 0.5% from annualInterestRate of
the base class. For example: if annualInterestRate is 3%, the
CDannualInterestRate will be 3.5% of a three-months CD
saving account, and the CDannualInterestRate will be 4% of
a six-month CD.
WEEK 9 ASSIGNMENT (CONTINUE)
Override displayAccount() and displayAccounts()
methods to print the account ID, CD annual interest
rate, the initial balance, the date when this account was
created, and account balance in each month according to
the duration if it is a CDAccount.
Write a driver program to test class CDAccount. Use
ArrayList to create five objects of class CDAccount with
balances of $1000.00 to $5000.00, and duration from 3month
to 15-months
respectively.
Set
the
annualInterestRate
to 3%. Calculate and print the
monthly interest of every month during the saving
period for each CDAccount.
(Perform a random shuffle for the elements in the
ArrayList before printing out the results.)

Explanation / Answer

    #include <iostream>
    #include <string>
    using namespace std;
    class CDAccount
    {
    private:
       static int number;
        int AcctNumbr;
        string OwnerName;
        string Accounttype;
        double CurrentBalance;
   
    public:
       CDAccount(void);
       CDAccount( string , double ) ;
       void withdraw( double );
       double getBalance() const;
      
    };       
    int CDAccount::number = 1001;
    CDAccount::CDAccount( void )
    {
    }
    CDAccount::CDAccount( string OwnerName, double balance )
    {
        cout << "default constructor.";
     
      
          
           Accounttype = "GA";
           CurrentBalance = balance;
           this ->OwnerName = OwnerName;
    }
    void CDAccount::withdraw (double amount)
    {
        if( amount > 0 && CurrentBalance >= amount )
        {
           CurrentBalance -= amount;
        }
    }
   
    double CDAccount::getBalance() const
    {
       return CurrentBalance;
    }
    int main ()
    {
       CDAccount bankList[10];
       int nextAcntIndex = 0;
       string name;
       double balance;
       int Accountnumber;
       int Withdrawl;
   
   
       int choice;
   
   
       do {
      system("cls");
       cout << endl;
       cout << " Select a menu option" << endl;
       cout << " 1. Creating an Account" << endl;
       cout << " 2. Debt" << endl;
       cout << " 3. Current Balance " << endl;
       cout << " 4. credit " << endl;
       cout << " 5. Exit " << endl;
       cout << endl;
       cout << " Enter your choice by using the numbers -->> ";
               cin >> choice;
               cin.clear();
               cin.ignore( INT_MAX, ' ' );
               switch( choice ) {
                   case 1:
                  
                       system( "cls" );
                   cout << "Enter your name: ";
                   cin >> name;
                   cout << "Enter your balance: ";
                   cin >> balance;
                   bankList[nextAcntIndex] = CDAccount( name, balance);
                   nextAcntIndex++;
                                      
                       break;
                   case 2:
                       system( "cls" );
                       cout << "Enter Account number; ";
                       cin >> Accountnumber;
                       cout << "Enter Withdrawl; ";
                       cin >> Withdrawl;
                       bankList [Accountnumber - 10001].withdraw ( Withdrawl );
                      
                  
                      
                       break;
                   case 3:
                       cout << " Enter Account number; ";
                       cin >> Accountnumber;
                       cout << "Currentbalance" <<   bankList [Accountnumber - 10001].getBalance ();
                      
                       break;
                   case 4:
                       cout << "Enter Account number; ";
                       cin >> Accountnumber;
                       cout << "Enter balance; ";
                       cin >> balance;
                      
                       break;
                   case 5:
                      
                   default:
                       cout << "That wasn't a choice";
                       break;
               }
           } while( choice !=5 );
           return 0;
    }

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