I have a homework assignment that I am totally stumped on. Here is what is required:
"Define the class BankAccount to store accout’s owner (define the class Person with one member variable name), account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide the following operations: set the account number, retrieve the
account number, retrieve the balance, deposit and withdraw money, and print account information. Add appropriate constructors.
Every bank offers a checking account. Derive the class CheckingAccount from the class BankAccount. A customer with a checking account typically maintains a minimum balance and pays service charges if the balance falls below the minimum balance. Add member variables to store this additional information. In addition to the operations inherited from the base class, this class should provide the following operations: set minimum balance, retrieve minimum balance, set service charges, retrieve service charges, verify if the balance is less than the minimum balance, withdraw, and print account information (override the
method of the base class). Add appropriate constructors.
Every bank offers a savings account. Derive the class SavingsAccount from the class BankAccount. A customer with a savings account typically receives interest, makes deposits, and withdraws money. In addition to the operations inherited from the base class, this class should provide the following
operations: set interest rate, retrieve interest rate, set interest earned, retrieve interest earned, post interest, withdraw, and print account information (override the method of the base class)."
This is what the output is suppose to be:
Create Checking Account for Jack (Account Number 1000) with $1050
Create Checking Account for Lisa (Account Number 1001) with $450
Create Checking Account for Omar (Account Number 1002) with $930
Create Checking Account for Rita (Account Number 1003) with $32
Minimum balance should be $1000 dollars and service charge is $40.
Create Saving Account for Jack (AN:2000, interest:4%) with $1000
Create Saving Account for Lisa (AN:2001, interest:7%) with $2000
Create Saving Account for Omar (AN:2002, interest:5%) with $1600
Create Saving Account for Rita (AN:2003, interest:3%) with $500
Jack withdraws the amount of $120 from Checking
Rita withdraws the amount of $90 from Savings
Lisa withdraws the amount of $120 from Checking
Omar deposits the amount of $290 to Checking
Post Interest on Jack's Saving Account
Post Interest on Lisa's Saving Account
Post Interest on Omar's Saving Account
Post Interest on Rita's Saving Account
Verify whether the balance is less than the minimum balance or not.
Deposit $1000 into Jack's Checking Account
Deposit $2300 into Lisa's Saving Account
Deposit $800 into Omar's Checking Account
Deposit $500 into Rita's Saving Account
Print Jack's Checking Account Information
Print Lisa's Checking Account Information
Print Omar's Checking Account Information
Print Rita's Checking Account Information
(Name - Account Number - Balance - Service Charges Paid
Print Jack's Saving Account Information
Print Lisa's Saving Account Information
Print Omar's Saving Account Information
Print Rita's Saving Account Information
(Name - Account Number - Balance – Interest Earned)
|
I've programmed what I know so far but I don't know where to go on from there. I don't expect anyone to write this program for me, just guiding me through this would help. My TA (Teacher's Assistants) aren't in their office to help me. Thank you!
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
|
#include<iostream>
using namespace std;
class BankAccount{ //set and retrieve account number, retrieve balance, deposit and withdraw money and print account information
public:
BankAccount(){};
int setAcctNum()[];
int findAcctNum()[];
double findBalance()[
return balance;
];
void deposit(double balance)[
balance += amount;
];
void withdraw()[];
void printAcct()[];
private:
int acctNumber;
double balance;
};
class CheckingAccount: public BankAccount{ //set and retrieve min balance, set and retrieve service charge,verify if balance is less than min balance, withdaw, and print account info
public:
CheckingAccount(){};
double findMinBal(){
return minBalance;
};
};
class SavingsAccount: public BankAccount{ //set and retrieve interest rate, set and retrieve interest earned, post interest, withdraw, and print account info
public:
SavingsAccount(){};
};
int main(){
BankAccount bAccounts[4];
bAccounts[0] = Jack;
bAccounts[1] = Lisa;
bAccounts[2] = Omar;
bAccounts[3] = Rita;
return 0;
}
|