Question: so the program that im working on is a java class program. https://www.chegg.com/homework-help/questions-and-answers/program-9-bankaccount-subclasses-assigned-date-due-date-concepts-classes-objects-inheritan-q32802774 that is the url. the guy who answered complicated the whole thing
so the program that im working on is a java class program. https://www.chegg.com/homework-help/questions-and-answers/program-9-bankaccount-subclasses-assigned-date-due-date-concepts-classes-objects-inheritan-q32802774
that is the url. the guy who answered complicated the whole thing and it wasn't even the right output. this is what i have currently and i need help finishing it. please correct my errors so it prints th exact output and make sure everything the teacher requried is there. if you know you can't please don't waste my time and let someone who can take care of it. thank you.
import java.util.*;
import java.util.Date;
public class program9 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
System.out.print("Enter the amount of money to create a savings account: ");
double balance = reader.nextDouble();
System.out.print("Enter the interest rate of the savings account");
double interestrate = reader.nextDouble();
System.out.print("Enter the amount of money to create a checking account: ");
double balance2 = reader.nextDoube();
System.out.println("");
}
}
//BankAcount class
class BankAccount {
private int iD;
private static int nextiD = 1;
private double balance;
private Date dateCreated;
public BankAccount(double balance) {
this.balance = balance;
dateCreated = new Date();
iD = nextiD;
nextiD++;
}
public void withdraw(double amount)
{
balance -= amount;
}
public void deposit(double amount)
{
balance += amount;
}
public int getAccountId() {
return iD;
}
public double getBalance() {
return balance;
}
public Date getDateCreated() {
return dateCreated;
}
@Override
public String toString()
{
return ("Account ID: " + iD + " Balance: " + balance + " Date Created: " + dateCreated);
}
}
//SavingsAccount class
class SavingsAccount extends BankAccount {
private double interestRate;
public SavingsAccount(double balance, double interestRate) {
super(balance);
this.interestRate = interestRate;
}
public void addInterestRate(double interestRate)
{
super.deposit(super.getBalance() * interestRate);
}
public double getInterestRate() {
return interestRate;
}
public void setInterestRate(double interestRate) {
this.interestRate = interestRate;
}
@Override
public String toString()
{
return (super.toString() + " Interest rate: " + interestRate);
}
}
//CheckingAccount class
class CheckingAccount extends BankAccount{
private double monthlyFee;
public CheckingAccount(double monthlyFee, double balance) {
super(balance);
this.monthlyFee = monthlyFee;
}
public void deductFee(double amount)
{
super.withdraw(amount);
}
public double getMonthlyFee() {
return monthlyFee;
}
public void setMonthlyFee(double monthlyFee) {
this.monthlyFee = monthlyFee;
}
@Override
public String toString()
{
return (super.toString() + " Monthly Fee: " + monthlyFee);
}
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
