PLEASE HELP ME.
You have been developing a BankAccount class for Parkville Bank that contains several fields and functions.
a. Create BankAccount contains only an account number and a balance.
b. Create a class named SavingsAccount that descends from BankAccount. Include
an interest rate field that is initialized to 3 percent when a SavingsAccount is
constructed.
c. Create a class named CheckingAccount that descends from BankAccount. Include
two new fields including a monthly fee and the number of checks allowed per month;
both are entered from prompts within the constructor.
d. Write a main()function to demonstrate the SavingsAccount and CheckingAccount
classes. Save the file as CheckingAndSavings.cpp.
e. Add a constructor for the SavingsAccount class that requires a double argument that
is used to set the interest rate. Create a class named CheckingWithInterest that descends from both SavingsAccount and CheckingAccount. This class provides for special interest-bearing checking accounts. When you create a CheckingWithInterest object, force the interest rate to .02, but continue to prompt for values for all the other fields. Create an array of five CheckingWithInterest accounts, prompt the user for values for each, and display the accounts. Save the file as CheckingWithInterest.cpp.
So far, I only have this. I don't know how to do most of it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include<iostream>
using namespace std;
class BankAccount
{
public:
void setAccountNum();
void setCurrentBal();
void getInfo()
{
cout<<"\n\nEnter Customer Name :- ";
cin>>customerName;
cout<<"Enter Account Number :- ";
cin>>accountNum;
}
void displayInfo()
{
cout<<"\n\nCustomer Name :- "<<customerName;
cout<<"\nAccount Number :- "<<accountNum;
}
void displayBalance()
{
cout<<"\nBalance :- "<<currentBalance;
}
private:
char customerName[30];
int accountNum;
float currentBalance;
};
class SavingsAccount: public BankAccount
{
};
class CheckingAccount: public BankAccount
{
};
class CheckingWithInterest: public SavingsAccount, public CheckingAccount
{
};
int main()
{
cout<<"\n\t\tWELCOME TO PARKVILLE BANK!";
}
|
Am i doing this correct?