Question: I am practicing on making a loan repayment program for java for homework. ( past question i am stuck on ) It will have 4
I am practicing on making a loan repayment program for java for homework. past question i am stuck on
It will have main classes and attributes to them.
CLASSSavingsAccount ATTRIBUTES interestRate, balance BEHAVIOUR getBalance, addInterest, makeDeposit.
CLASS CurrentAccount ATTRIBUTES interestRate, balance BEHAVIOUR getBalance, addInterest, makeDeposit.
CLASS LoanAccount ATTRIBUTES interestRate, balance BEHAVIOUR getBalance, addInterest, makePayment.
CLASS PensionAccount ATTRIBUTES interestRate, withdrawalAmountBEHAVIOUR getBalance, addInterest, makePayment.
The names of the attributes and behaviour should make obvious to you what their function should be I will give a short explanation for each:
interestRate The monthly interest rate of each account. This should be a class variable example not an instance variable and also private to the class. In other words, any change to this attribute should reflect on all the instances of the class it belongs to This attribute should be initialised for each class as follows: The interestRate for SavingsAccount should be initialised to ie The interestRate for CurrentAccount should be initialised to ie The interestRate for LoanAccount should be initialised to ie The interestRate for PensionAccount should be initialised to ie
getBalance This method should take no arguments and return the balance. It is required because balance will not be accessible directly.
addInterest This method should compute and add the interest to the account using its interest rate. It takes no arguments and returns nothing.
makeDeposit This method should take the amount to be deposited to the account as an argument and add that to the balance.
makePayment This method should take the amount to be paid into the loan account and subtract that from the balance. For pension account, the amount needs to be added to the withdrawalAmount.
Each of the four classes should also have constructor methods. You are expected to use two constructors for each of the classes SavingsAccount, CurrentAccount and PensionAccount: one that takes no arguments and initialises the balance to and another that takes and uses a starting balance for the account to be created. There should only be one constructor method for the LoanAccount class that should take and use a starting balance example the amount borrowed when the account is created
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
