CSE1116_Lab06
CSE1116_Lab06
Lab Activities
• A private double data field named balance for the account (default 0.0).
• A private double data field named annualInterestRate that stores the current
interest rate (default 0.0).
• A private Calendar data field named dateCreated that stores the date when the
account was created. Use Calendar type object.
• A no-arg constructor that creates a default account.
• A constructor that creates an account with the specified id, initial balance and
annual interest rate. Within the constructor, assign the value of dateCreated using
Calendar.getInstance().
• The accessor and mutator methods for id, balance, and annualInterestRate.
Create two subclasses for checking and saving accounts named as CheckingAccount
and SavingsAccount.
• A savings account has issued with a credit card automatically. It holds the 16-digit
card number an expiry date (Calendar type object). SavingsAccount class must
have a method getCreditBalance() that returns a credit balance which is three
times of the current balance in the account.
You must create at least 4 account type objects in this manner and perform one deposit
and one withdraw operation for each account.
Afterwards, print the followings for each account using the concept of Polymorphism.
For a Checking Account: For a Savings Account:
Declare the Account class as an abstract class and all methods of Account as
abstract methods except constructors. Modify the rest of the code accordingly.