{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

N end of account class the saving class a subclass of

Info icon This preview shows pages 2–4. Sign up to view the full content.

View Full Document Right Arrow Icon
"Transaction rejected!\n" ; }; } }; // end of Account class //------------------------------------------------------------- // The "Saving" class - a subclass of the "Account" class //------------------------------------------------------------- class Saving : public Account { private : double intRate; public : Saving() { acctNo=0; lname= "" ; fname= "" ; balance=0.0; } Saving( int a, string l, string f, double b, double i) { acctNo=a; lname=l; fname=f; balance=b; intRate=i; } void getData() { cout << "Saving account # " ; Account::getData(); cout << "\t Interest rate = " << intRate << endl; } double getIntRate() { return intRate; } }; // End of "Saving" class //------------------------------------------------------------- // The "Checking" class - a subclass of the "Account" class //------------------------------------------------------------- class Checking : public Account { private : double monthCharge; public : Checking() { acctNo=0; lname= "" ; fname= "" ; balance=0.0; monthCharge=0.0; } Checking( int a, string l, string f, double b, double m) { acctNo=a; lname=l; fname=f; balance=b; monthCharge=m; } void getData() { cout << "Checking account# " ; Account::getData(); cout << "\t Monthly charge= " << monthCharge << endl; } double getMonthCharge() { return monthCharge; } };
Image of page 2

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CIS-247C Homework H72 solutions 4/11/2012 //------------------------------------------------------------- // The "main" funciton - uses "array of pointers" to objects //------------------------------------------------------------- int main() { Account *a[5]; // declare "array of pointers" of size 5 // First two points reference Saving objects a[0] = new Saving(2345, "Johnson" , "Mike" , 2355.60, 0.05); a[1] = new Saving(3456, "Smith" , "Sara" , 4500.00, 0.04); //
Image of page 3
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern