
- A V V 1 Create A Class Called Account A Attributes I String Accountnumber Default Value Empty String B Functions 1 (180.64 KiB) Viewed 41 times

- A V V 1 Create A Class Called Account A Attributes I String Accountnumber Default Value Empty String B Functions 2 (177.08 KiB) Viewed 41 times
a V. v. 1. Create a class called Account a. Attributes: i. string accountnumber: default value empty string b. Functions: i. string get accountnumber() ii. void set accountnumber(string) iii. Account() iv. Account (string) pure virtual double getbalance() 2. Create a class called BankAccount that inherits Account a. Attributes: i. double balance: default value 0.00 only non-zero b. Functions: i. virtual double getbalance() // returns the balance amount ii. void setbalance (double) // sets the balance amount iii. void deposit(double) // adds to the balance iv. void withdrawal(double) // deducts from the balance void showbalance() // shows the balance in the account vi. BankAccount() // default constructor vii. BankAccount(double) // overloaded constructor viii. BankAccount(double, string ) 11 overloaded constructor calling base class constructor 3. Create a class called CheckingAccount that inherits BankAccount a. Attributes: i. int fee: default value $5 b. Functions: i. int get fee) // returns fee ii. void setfee(int) // sets fee iii. CheckingAccount() // default constructor iv. CheckingAccount(int) // overloaded constructor V. CheckingAccount(int, double, string) // overloaded constructor calling base class constructor vi. double getbalance() // returns balance according to the following rule: if balance is less than 100, it deducts the fee from the original balance otherwise no deductions take place 4. Create a class called SavingsAccount that inherits BankAccount a. Attributes: i. double interestrate default value is 5% b. Functions: i. double getinterestrate() // returns interestrate ii. void setinterestrate(double) // sets interestrate iii. SavingsAccount() // default constructor iv. SavingsAccount(double) // overloaded constructor V. SavingsAccount (double, double, string) // overloaded constructor calling base class constructors vi. double getbalance() // calculates the balance as the original balance plus balance times interest rate and returns the new balance
5. Create a class called Person a. Attributes: i. string name default is empty string ii. BankAccount* checking default is NULL iii. BankAccount* savings default is NULL b. Functions: i. string getname() // returns name ii. BankAccount* getchecking() // returns checking (pointer) iii. BankAccount* getsavings() // returns savings (pointer) iv. void setname(string) // set the name v. void setchecking(int, double, string) // creates a dynamic CheckingAccount object, using the parameters for the overloaded constructor and points the checking member to the object vi. void setsavings (double, double, string) // creates a dynamic Savings Account object, using the parameters for the overloaded constructor and points the savings member to the object vii. Person() // default constructor viii. Person(string) il overloaded constructor setting the name only ix. Person(string, string, double, int) // overloaded constructor setting the name member and creating a dynamic CheckingAccount object and calling its constructor using the parameters x. Person(string, string, double, double) // overloaded constructor setting the name member and creating a dynamic SavingsAccount object and calling its constructor using the parameters xi. double totalworth() // adds the balances of checking and savings accounts and returns the sum 6. Create a main function and execute the following instructions: a. Create a Person object called customer with the customer's name "Bob”. (this should be a single instruction) b. Set a checking account for the customer with the following data: i. fee is $3 ii. balance is $50 iii. accountnumber is "23456" C. Set a savings account for customer with the following data: i. interest rate is 15% ii. balance is $1000 iii. accountnumber is "98765" d. Deposit $100 into the checking account e. Withdraw $250 from the savings account f. Display the total worth of the customer.