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

Here is what I am looking to modify my current program: Redo your definition of

ID: 3617406 • Letter: H

Question

Here is what I am looking to modify my current program: Redo your definition of the class CDAccount from your currentprogramming project so that it has the same interface but adifferent implementation. The new implementation for the classCDAccount will record the balance as two values of type int:one for dollars and one for cents. The member variable for theinterest rate will store the interest rate as a fraction ratherthan as a percentage. For example, an interest rate of 5.9 % willbe stored as the value of 0.059 of type double. Here is my current program: //this project redefines CDAccount from display so thatit is a class rather than a structure // included in the project is member function for each ofthe following: //initial balance return //balance at maturity return //interest rate return // a constructor is also included that sets all the membervariables to a specified value // as well as a default constructor //class definition is enbedded in a test program //also included is an input member function with one formalparameter of type istream and //an output member function with one formal parameter of typeostream.                 #include <iostream> #include <fstream> using namespace std;

class CDAccount {
public:    CDAccount(); //defaultconstructor    CDAccount (doublenew_balance,double new_interest_rate,int new_term); //parameterizedconstruction    double get_initial_balance();//function declaration    double get_balance_at_maturity();    double get_interest_rate ();    int get_term ();
   void input (istream&istr);    void output (ostream&ostr);
private://variable declaration    double balance; //balance    double interest_rate; //interestrate in %    int term; //month cd will maturein
};
int main()//declaring objects with parameters {    CDAccount account (100, 10.0,6);    account.output(cout);    cout << "Enter the CD initialbalance, interest rate, and term." << endl;    account.input(cin);          ofstream file_out;    file_out.open("Account_info.txt");    if (file_out.fail())    {    cout << "Could notopen file." << endl;    exit (1);       }          account.output(file_out);      file_out.close();    system("pause");    return 0; }
CDAccount::CDAccount() { balance = 0; interest_rate = 0; term = 0; } CDAccount::CDAccount (double new_balance, doublenew_interest_rate, int new_term) :    balance(new_balance),interest_rate(new_interest_rate), term(new_term) { }   
   double CDAccount::get_initial_balance() {    return balance;//returnsbalance-original }
   double CDAccount::get_balance_at_maturity() {    double interest = balance * (interest_rate/ 100) * (term/12.0);    return balance + interest;//returns finalbalance after maturity }
   double CDAccount::get_interest_rate() {    return interest_rate;//return interestrate } int CDAccount::get_term () { return term;//returns term }
   void CDAccount::input (istream&istr)//data inputting {   istr >> balance;   istr >> interest_rate;   istr >> term; }    void CDAccount::output (ostream&ostr)//outputting member of class {   ostr.setf(ios::fixed);   ostr.setf(ios::showpoint);   ostr.precision(2);   ostr << "CD Account interest rate: "<< get_interest_rate() <<endl;// interest rate   ostr << "CD Account initial balance: "<< get_initial_balance() << endl;//initialbalance   ostr << "When your CD matures in " <<get_term() << " months," << endl;//cd maturity periodin months   ostr << "it will have a balance of "<< get_balance_at_maturity() << " dollars." <<endl;//final balance after maturity   ostr << endl; }

Redo your definition of the class CDAccount from your currentprogramming project so that it has the same interface but adifferent implementation. The new implementation for the classCDAccount will record the balance as two values of type int:one for dollars and one for cents. The member variable for theinterest rate will store the interest rate as a fraction ratherthan as a percentage. For example, an interest rate of 5.9 % willbe stored as the value of 0.059 of type double. Here is my current program: //this project redefines CDAccount from display so thatit is a class rather than a structure // included in the project is member function for each ofthe following: //initial balance return //balance at maturity return //interest rate return // a constructor is also included that sets all the membervariables to a specified value // as well as a default constructor //class definition is enbedded in a test program //also included is an input member function with one formalparameter of type istream and //an output member function with one formal parameter of typeostream.                 #include <iostream> #include <fstream> using namespace std;

class CDAccount {
public:    CDAccount(); //defaultconstructor    CDAccount (doublenew_balance,double new_interest_rate,int new_term); //parameterizedconstruction    double get_initial_balance();//function declaration    double get_balance_at_maturity();    double get_interest_rate ();    int get_term ();
   void input (istream&istr);    void output (ostream&ostr);
private://variable declaration    double balance; //balance    double interest_rate; //interestrate in %    int term; //month cd will maturein
};
int main()//declaring objects with parameters {    CDAccount account (100, 10.0,6);    account.output(cout);    cout << "Enter the CD initialbalance, interest rate, and term." << endl;    account.input(cin);          ofstream file_out;    file_out.open("Account_info.txt");    if (file_out.fail())    {    cout << "Could notopen file." << endl;    exit (1);       }          account.output(file_out);      file_out.close();    system("pause");    return 0; }
CDAccount::CDAccount() { balance = 0; interest_rate = 0; term = 0; } CDAccount::CDAccount (double new_balance, doublenew_interest_rate, int new_term) :    balance(new_balance),interest_rate(new_interest_rate), term(new_term) { }   
   double CDAccount::get_initial_balance() {    return balance;//returnsbalance-original }
   double CDAccount::get_balance_at_maturity() {    double interest = balance * (interest_rate/ 100) * (term/12.0);    return balance + interest;//returns finalbalance after maturity }
   double CDAccount::get_interest_rate() {    return interest_rate;//return interestrate } int CDAccount::get_term () { return term;//returns term }
   void CDAccount::input (istream&istr)//data inputting {   istr >> balance;   istr >> interest_rate;   istr >> term; }    void CDAccount::output (ostream&ostr)//outputting member of class {   ostr.setf(ios::fixed);   ostr.setf(ios::showpoint);   ostr.precision(2);   ostr << "CD Account interest rate: "<< get_interest_rate() <<endl;// interest rate   ostr << "CD Account initial balance: "<< get_initial_balance() << endl;//initialbalance   ostr << "When your CD matures in " <<get_term() << " months," << endl;//cd maturity periodin months   ostr << "it will have a balance of "<< get_balance_at_maturity() << " dollars." <<endl;//final balance after maturity   ostr << endl; }
//this project redefines CDAccount from display so thatit is a class rather than a structure // included in the project is member function for each ofthe following: //initial balance return //balance at maturity return //interest rate return // a constructor is also included that sets all the membervariables to a specified value // as well as a default constructor //class definition is enbedded in a test program //also included is an input member function with one formalparameter of type istream and //an output member function with one formal parameter of typeostream.                 #include <iostream> #include <fstream> using namespace std;

class CDAccount {
public:    CDAccount(); //defaultconstructor    CDAccount (doublenew_balance,double new_interest_rate,int new_term); //parameterizedconstruction    double get_initial_balance();//function declaration    double get_balance_at_maturity();    double get_interest_rate ();    int get_term ();
   void input (istream&istr);    void output (ostream&ostr);
private://variable declaration    double balance; //balance    double interest_rate; //interestrate in %    int term; //month cd will maturein
};
int main()//declaring objects with parameters {    CDAccount account (100, 10.0,6);    account.output(cout);    cout << "Enter the CD initialbalance, interest rate, and term." << endl;    account.input(cin);          ofstream file_out;    file_out.open("Account_info.txt");    if (file_out.fail())    {    cout << "Could notopen file." << endl;    exit (1);       }          account.output(file_out);      file_out.close();    system("pause");    return 0; }
CDAccount::CDAccount() { balance = 0; interest_rate = 0; term = 0; } CDAccount::CDAccount (double new_balance, doublenew_interest_rate, int new_term) :    balance(new_balance),interest_rate(new_interest_rate), term(new_term) { }   
   double CDAccount::get_initial_balance() {    return balance;//returnsbalance-original }
   double CDAccount::get_balance_at_maturity() {    double interest = balance * (interest_rate/ 100) * (term/12.0);    return balance + interest;//returns finalbalance after maturity }
   double CDAccount::get_interest_rate() {    return interest_rate;//return interestrate } int CDAccount::get_term () { return term;//returns term }
   void CDAccount::input (istream&istr)//data inputting {   istr >> balance;   istr >> interest_rate;   istr >> term; }    void CDAccount::output (ostream&ostr)//outputting member of class {   ostr.setf(ios::fixed);   ostr.setf(ios::showpoint);   ostr.precision(2);   ostr << "CD Account interest rate: "<< get_interest_rate() <<endl;// interest rate   ostr << "CD Account initial balance: "<< get_initial_balance() << endl;//initialbalance   ostr << "When your CD matures in " <<get_term() << " months," << endl;//cd maturity periodin months   ostr << "it will have a balance of "<< get_balance_at_maturity() << " dollars." <<endl;//final balance after maturity   ostr << endl; }

Explanation / Answer

please rate - thanks //this project redefines CDAccount from display so that it isa class rather than a structure // included in the project is member function for each of thefollowing: //initial balance return //balance at maturity return //interest rate return // a constructor is also included that sets all the membervariables to a specified value // as well as a default constructor //class definition is enbedded in a test program //also included is an input member function with one formalparameter of type istream and //an output member function with one formal parameter of typeostream.                                               #include #include using namespace std; class CDAccount { public:        CDAccount(); //defaultconstructor        CDAccount (int new_dollars,intnew_cents,double new_interest_rate,int new_term); //parameterizedconstruction        int get_initial_dollars();//function declaration                int get_dollars_at_maturity();        int get_initial_cents();//function declaration                int get_cents_at_maturity();        double get_interest_rate();        int get_term ();        void input (istream&istr);        void output (ostream&ostr); private://variable declaration        int dollars; //balance        int cents;        double interest_rate;//interest rate in %        int term; //month cd willmature in }; int main()//declaring objects with parameters {       CDAccount account (100,0, 10,6);       account.output(cout);       cout > term; }        void CDAccount::output(ostream &ostr)//outputting member of class { ostr.setf(ios::fixed); ostr.setf(ios::showpoint); ostr.precision(2); ostr