BankAccount Savings CreditCard CPP Solution

profileTopsolutions
 (Not rated)
 (Not rated)
Chat

GRAND RAPIDS COMMUNITY COLLEGE
COMPUTER APPLICATIONSDIVISION

 

C0-227 C++ PROGRAMMING

 

PROJECT Bank Account

 

Assignment #6

Handed Out: Week 7

Points Available: 20

 

Concepts and Ideas

Objects and Classes - Inheritance

 

 

Assignment

            Start a console application called Bank that will contain three classes: BankAccount, then Savings and CreditCard.  Write a base class called BankAccount.  Remember that base classes aren't complete, rather offer functionality to other derived classes.  The BankAccount class should have the following member variables and methods.

 

1.    Private Member Variables: mInterestRate, mPrincipal, mLastAccessTime

 

2.    Public Member Methods: float CalculateInterest(int Time), float GetInterestRate(), float GetPrincipal(), SetInterestRate(float IR), SetPrincipal(int Time, float Amount)

 

The Get and Set methods should be pretty obvious.  Assume that the amount entered for principal is in dollars.  Similarly, the interest rate is annual interest.  I used 12.0 to represent 12.0 percent annual interest (instead of 0.12).  CalculateInterest method calculates the amount of time passed and returns the interest earned.  Notice that time is simply an integer.  Time for a computer is usually a number that keeps increasing (usually in ms) from some set date and time.  To simplify this problem, assume time is in days and that the calling function will give you the time (in days).   Then the time passed (used to calculate interest) on will be: (Time – mLastAccessTime).

 

Once you get this class written and functional, generate another class that inherits the BankAccount class called Savings.  A savings account "is a" bank account.  Add the following methods to this class:

 

1.    void Deposit(int Time, float Amount) - If it is a new account, simply use the SetPrincipal() method from BankAccount.  If you have an existing account, then you need to add to the principal the interest earned and the deposit amount.

 

2.    bool Withdrawal(int Time, float Amount) - Check to see if the account has enough in it to make the withdrawal (remember the interest they've earned), then make the withdrawal.  If you make the withdrawal, return true, else return false.

 

3.    float GetBalance(int Time) - Simply returns the balance (including interest) of the account based on the time you send the function.

 


After you have Savings complete, generate another class like Savings Called CreditCard.  This class will also inherit from BankAccount and have the following methods:

 

1.   void Payment(int Time, float Amount) – decrease the balance after adding the interest.

2.   void SetCreditLimit(float Amount) – obvious, simply set the value.

3.   bool Charge(int Time, float Amount) – make sure to check to see if there is available credit before making the charge.  Return true is the charge is OK.  Return false if there isn’t sufficient available credit.

4.   float getAvailableCredit(int Time) – return the amount of available credit which involves the Principal and Interest.

To test and complete the project, use the supplied Bank.cpp file to test the classes.  The output should be exactly like (within a penny) of Bank.exe.  You know you’re done when your classes work like the example  Bank.exe.  Submit your project via Blackboard.

 

 

    • 11 years ago
    Complete A++ Solution
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      bankaccount_savings_creditcard_cpp.zip