folder should contain the following files: Account java Checking java Savingsjav
ID: 3783619 • Letter: F
Question
folder should contain the following files: Account java Checking java Savingsjava TestAccount java (contains the Test program) A readme.txt containing any instructions you want to provide to your instructor Make sure your java files compile without any compiler errors. You will not receive any credit for programs with compiler errors. If you are unable to complete your program, submit the parts that work with no compiler errors for partial credit. Objectives: The objectives of this programming assignment are to understand the following concepts: Creating class Creating subclasses Inheriting data and methods Overloading methods Overriding methods Invoking constructor of the superclass Use of the keyword superExplanation / Answer
1.----------Account class creation------------------------
class Account {
//data declaration
int accountId;
double balance;
double annualInterestRate;
Date dateCreated;
//no arg constructor
Account () {
accountId = 0;
balance = 0.0;
annualInterestRate = 0.0;
}
//constructor with specific id and initial balance & AnnualInterestRate
Account(int accountId, double balance, double AnnualInterestRate) {
this.accountId = accountId;
this.balance = balance;
this.annualInterestRate = AnnualInterestRate;
}
//accessor/mutator methods for accountId, balance, and annualInterestRate
public int getaccountId() {
return this.accountId;
}
public double getBalance() {
return this.balance;
}
public double getAnnualInterestRate() {
return this.annualInterestRate;
}
public void setaccountId(int accountId) {
this.accountId = accountId;
}
public void setBalance(double balance) {
this.balance = balance;
}
public void setAnnualInterestRate(double AnnualInterestRate) {
this.annualInterestRate = AnnualInterestRate;
}
//accessor method for dateCreated
public void getdateCreated() {
return this.dateCreated;
}
//define method getMonthlyInterestRate
double getMonthlyInterestRate() {
return annualInterestRate/12;
}
//define method withdraw
double withdraw(double amount) {
return balance = balanace-amount;
}
//define method deposit overloading
int deposit(int amount) {
return balance + amount;
}
double deposit(double amount) {
return balance + amount;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.