Question: C++ CODE ONLY PROGRAMMING PROJECT 2 IS LISTED BELOW /* Do Programming Project 2 on page 611. Then try to finish * independently by complete
C++ CODE ONLY PROGRAMMING PROJECT 2 IS LISTED BELOW /* Do Programming Project 2 on page 611. Then try to finish * independently by complete this sample file. * */ #includeusing namespace std; class CDAccount { public: CDAccount(); CDAccount(double new_balance, double new_interest_rate, int new_term); double get_initial_balance() const; double get_balance_at_maturity() const; double get_interest_rate() const; int get_term() const; void input(istream& in); void output(ostream& out); private: int dollar; int cent; double interest_rate; int term; // months until maturity }; int main() { // You implement the test code here // You may watch the video note to get the idea // notice that user will only enter balance as a double value // You may implement it as a menu oriented testing program // which be able to test constructors, methods of CDAccount class } // Implement the class definition here. Notice that the interfaces are the // same as in Programming Project 1. However, the implementation will be // different since the private information balance is stored differently // for example, the input function will only read the balance, itnerest rate // and term from the user. So it should be modified as following void CDAccount::input(istream& in) { double balance; in >> balance; // get initial balance from user // convert balance to dollars and cents since this is how balance stored dollar = (int) balance; // dollar is the interger part of balace cent = (int) ((balance - dollar)*100); // cent is the fraction part * 100 in >> interest_rate; // get interest rate from user in >> term; // get term from user }

2. Redo your definition of the class CDAccount from Practice Program 1 so that it has the same interface but a different implementation. The new implementation is in many ways similar to the second implementation for the class BankAccount given in Display 10.7. Your new implementation for the class CDAccount will record the balance as two values of type int: one for the dollars and one for the cents, The member variable for the interest rate will store the interest rate as a fraction rather than as a percentage. For will be stored as the value o double. Store the term in the same way as in Display 10.1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
