0% found this document useful (0 votes)
8 views

Assignment 3

uhiokj

Uploaded by

ikk015605
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Assignment 3

uhiokj

Uploaded by

ikk015605
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

The University of Jordan

Faculty of Business
MIS Department
Business Software Development

Assignment 3

Create an inheritance hierarchy that a bank might use to represent


customers’ bank accounts. All customers at this bank can deposit (i.e.,
credit) money into their accounts and withdraw (i.e., debit) money from
their accounts. More specific type of accounts also exist. Savings
accounts, for instance, earn interest on the money they hold. Create base
class Account and derived classes SavingsAccount that inherit from class
Account.

Base class Account should include one private instance variable of type
decimal to represent the account balance. The class should provide a
constructor that receives an initial balance and uses it to initialize the
instance variable with a public property. The property should validate the
initial balance to ensure that it’s greater than or equal to 0.0; if not, throw
an exception.
The class should provide two public methods. Method Credit should add
an amount to the current balance. Method Debit should withdraw money
from the Account and ensure that the debit amount does not exceed the
Account’s balance. SavingsAccount class include a decimal instance
variable indicating the interest rate (percentage) assigned to the Account.
SavingsAccount’s constructor should receive the initial balance, as well as
an initial value for the interest rate. SavingsAccount should provide public
method CalculateInterest that returns a decimal indicating the amount of
interest earned by an account.

Write an app that creates objects and tests their methods. Add interest to
the SavingsAccount object by first invoking its CalculateInterest method,
then passing the returned interest amount to the object’s Credit method.

Dr. MAHMOUD MAQABLEH


1

You might also like