Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include using 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
#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 }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started