Using JAVA An account record has the following: Account name Account surname Account number Account type Interest Balance Create an AccountRecord class, complete with accessors and mutators (get and set methods) for the instant variables as well as the toString method for formatting the object. The Account Record class must have an abstract method called calculateinterest A savings account must have a minimum balance of R500 and has an annual interest of 5%, If the balance is greater than R10000 the annual interest is 7% and if the balance is greater than R50000 the annual interest is 8% An investment account must have a minimum balance of R100000 and the annual interest is 9%, Withdrawals cannot be made on an investment account. A check account can have a minimum balance of RO. The annual interest is 2% if the balance is greater R20000. If the balance is greater than R100000 the annual interest can be 4% Each of the subclasses must have at least two constructors. The savings account, investment account and check account are all subclasses of AccountRecord, The super 0) keywork must be used in both the constructors and the toString() methods of the subclasses, All account types are able to make a deposit. The savings and check accounts can also make a withdrawal as long as there is enough minimum balance after the withdrawal, You can input a minimum of three different account instances Use any of the collections to populate your account objects. Implement this example, out putting all the instance variables of each object. Your application should have a minimum of 6 classes Below is the sample code - complete the program public abstract class AccountRecord { float interest, minBalance, currBalance; boolean isWithdrawalAllowed; String name, surname, number,type; public String getName() { return name; } public String getSurname() { return surname; } public String getNumber() { return number; } public String getType() { return type; } public boolean isWithdrawalAllowed() { return isWithdrawalAllowed; } public void setWithdrawalAllowed(boolean withdrawalAllowed) { isWithdrawalAllowed = withdrawalAllowed; } public float getInterest() { return interest; } public void setInterest(float interest) { this.interest = interest; } public float getMinBalance() { return minBalance; } public void setMinBalance(float minBalance) { this.minBalance = minBalance; } public float getCurrBalance() { return currBalance; } public void setCurrBalance(float currBalance) { this.currBalance = currBalance; } abstract void calculateinterest(); } ------------------------------------------------------------------- SavingsAccount.java: public class SavingsAccount extends AccountRecord { public SavingsAccount() { this.setMinBalance(500); if(this.getCurrBalance() > this.getMinBalance()) this.setWithdrawalAllowed(true); } @Override void calculateinterest() { if(this.getCurrBalance()<=10000) { this.setInterest((float) 0.05); } else if(this.getCurrBalance()>10000 && this.getCurrBalance()<=50000) { this.setInterest((float) 0.07); } else if(this.getCurrBalance()>50000) { this.setInterest((float) 0.08); } } } ------------------------------------------------------------------- InvestmentAccount.java: public class InvestmentAccount extends AccountRecord{ public InvestmentAccount() { this.setMinBalance(100000); this.setWithdrawalAllowed(false); } @Override void calculateinterest() { this.setInterest((float) 0.09); } } ------------------------------------------------------------------- CheckAccount.java: public class CheckAccount extends AccountRecord { public CheckAccount() { this.setMinBalance(0); if(this.getCurrBalance() > this.getMinBalance()) this.setWithdrawalAllowed(true); } @Override void calculateinterest() { if(this.getCurrBalance()>20000 && this.getCurrBalance()<=10000) { this.setInterest((float) 0.02); } else { this.setInterest((float) 0.04); } } }
Using JAVA
An account record has the following:
Account name
Account surname
Account number
Account type
Interest
Balance
Create an AccountRecord class, complete with accessors and mutators (get and set methods) for the
instant variables as well as the toString method for formatting the object.
The Account Record class must have an abstract method called calculateinterest
A savings account must have a minimum balance of R500 and has an annual interest of 5%, If the
balance is greater than R10000 the annual interest is 7% and if the balance is greater than R50000 the
annual interest is 8%
An investment account must have a minimum balance of R100000 and the annual interest is 9%,
Withdrawals cannot be made on an investment account.
A check account can have a minimum balance of RO. The annual interest is 2% if the balance is greater
R20000. If the balance is greater than R100000 the annual interest can be 4%
Each of the subclasses must have at least two constructors.
The savings account, investment account and check account are all subclasses of AccountRecord, The
super 0) keywork must be used in both the constructors and the toString() methods of the subclasses,
All account types are able to make a deposit.
The savings and check accounts can also make a withdrawal as long as there is enough minimum
balance after the withdrawal,
You can input a minimum of three different account instances
Use any of the collections to populate your account objects.
Implement this example, out putting all the instance variables of each object.
Your application should have a minimum of 6 classes
public abstract class AccountRecord {
float interest, minBalance, currBalance;
boolean isWithdrawalAllowed;
String name, surname, number,type;
public String getName() {
return name;
}
public String getSurname() {
return surname;
}
public String getNumber() {
return number;
}
public String getType() {
return type;
}
public boolean isWithdrawalAllowed() {
return isWithdrawalAllowed;
}
public void setWithdrawalAllowed(boolean withdrawalAllowed) {
isWithdrawalAllowed = withdrawalAllowed;
}
public float getInterest() {
return interest;
}
public void setInterest(float interest) {
this.interest = interest;
}
public float getMinBalance() {
return minBalance;
}
public void setMinBalance(float minBalance) {
this.minBalance = minBalance;
}
public float getCurrBalance() {
return currBalance;
}
public void setCurrBalance(float currBalance) {
this.currBalance = currBalance;
}
abstract void calculateinterest();
}
SavingsAccount.java:
public class SavingsAccount extends AccountRecord {
public SavingsAccount() {
this.setMinBalance(500);
if(this.getCurrBalance() > this.getMinBalance())
this.setWithdrawalAllowed(true);
}
@Override
void calculateinterest() {
if(this.getCurrBalance()<=10000) {
this.setInterest((float) 0.05);
}
else if(this.getCurrBalance()>10000 && this.getCurrBalance()<=50000) {
this.setInterest((float) 0.07);
}
else if(this.getCurrBalance()>50000) {
this.setInterest((float) 0.08);
}
}
}
InvestmentAccount.java:
public class InvestmentAccount extends AccountRecord{
public InvestmentAccount() {
this.setMinBalance(100000);
this.setWithdrawalAllowed(false);
}
@Override
void calculateinterest() {
this.setInterest((float) 0.09);
}
}
CheckAccount.java:
public class CheckAccount extends AccountRecord {
public CheckAccount() {
this.setMinBalance(0);
if(this.getCurrBalance() > this.getMinBalance())
this.setWithdrawalAllowed(true);
}
@Override
void calculateinterest() {
if(this.getCurrBalance()>20000 && this.getCurrBalance()<=10000) {
this.setInterest((float) 0.02);
}
else {
this.setInterest((float) 0.04);
}
}
}
Trending now
This is a popular solution!
Step by step
Solved in 2 steps