Question
Question: Redefine CDAccount from Display 10.1 so that it is a class rather than a structure. Use the same member variables as in Display 10.1
Question:
Redefine CDAccount from Display 10.1 so that it is a class rather than a structure. Use the same member variables as in Display 10.1 but make them private. Include member functions for each of the following: one to return the initial balance, one to return the balance at maturity, on e to return the interest rate, and one to return the term. Include a constructor that sets all of the member variables to any specified values, as well as a default constructor. Also, include an input member function with one formal parameter of type istream and an output member function with one formal parameter of type ostream. Embed your class definition in a test program.
10.1 is as follows
#include
Guidelines from Teacher
private member variables to hold the three values of a CD account
a default constructor that initializes the private member variables
a constructor that accepts three initial values for the private member variables
member functions to return the current value of each of the private member variables
a member function that calculates and returns the account balance at maturity based on the values in the three member variables.
a member function that accepts an argument of type istream and reads the three member values from the open input stream
a member function that accepts an argument of type ostream and writes a nicely formatted summary of the account values to that open output stream
For the sake of this assignment, your test program should only use cin to read and cout to write. Please write your input/output member functions so that they could accept an open file stream, but you don't need to demonstrate reading from or writing to files.
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