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

Mary has inherited $100,000 and she has put it in a money market that pays a 2%

ID: 3645313 • Letter: M

Question

Mary has inherited $100,000 and she has put it in a money market that pays a 2% interest per year. She withdraws $25,000 a year. She wants to know how many years it takes her to spend all of the money. Come up with a class to solve the problem. The class must have at least two member functions and some private variables needed. The class must also have the default constructor.
Declare an object of the class in the main() and use the object to call member functions to do the desired tasks.

Explanation / Answer

#include #include #include #define rate 2 class Interest{ char name[20]; int count=0; float p,t,si; public: void getdata(); //class with void processdata(); //three member void putdata(); //function }object; /*Defining the different purpose of each function Getting Data from the user*/ void Interest::getdata(){ cout p; cout > t; } /*Calculating the simple interest*/ void Interest::processdata(){ si = p * 1 * rate / 100; p=p+si-t; count++; while(p>0){ this.processdata(); } } /*Producing all the data to the VDU*/ void Interest::putdata(){ cout