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); } } }

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

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);
}
}
}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,