Question: I've been having problems with my code and I dont know how to fix it. I'm having trouble where it says //error here public abstract

I've been having problems with my code and I dont know how to fix it. I'm having trouble where it says //error here

public abstract class BankAccount { protected double balance; protected int numDeposits; protected int numWithdrawals; protected double interestRate; protected double monthlyServiceCharge; public BankAccount(double bal, double intRate, double mon) { balance = bal; interestRate = intRate; monthlyServiceCharge = mon; } public void deposit(double amount) { balance += amount; numDeposits++; } public void withdraw(double amount) { balance -= amount; numWithdrawals++; } protected void calcInterest() { double monthlyInterestRate = interestRate / 12; double monthlyInterest = balance * monthlyInterestRate; balance += monthlyInterest; } public void monthlyProcess() { balance -= monthlyServiceCharge; calcInterest(); numDeposits = 0; numWithdrawals = 0; } public void setMonthlyServiceCharges(double amount) { this.monthlyServiceCharge += amount; } public double getBalance() { return balance; } public int getNumDeposits() { return numDeposits; } public int getNumWithdrawals() { return numWithdrawals; } public double getInterestRate() { return interestRate; } public double getMonthlyServiceCharges() { return monthlyServiceCharge; } }

public class SavingsAccount extends BankAccount { public SavingsAccount(double bal, double intRate, double mon) { super(bal, intRate, mon); } public boolean isActive() { return balance >= 50; } public void withdraw(double amount) { if (isActive() == false) { throw new IllegalStateException("This account is inactive."); } super.withdraw(amount);

}

public void monthlyProcess() { int costlyWithdrawals = numWithdrawals - 5;

if (costlyWithdrawals > 0) { monthlyServiceCharge += costlyWithdrawals * 0.5;

} super.monthlyProcess();

}

}

import java.text.DecimalFormat; import java.util.Scanner;

public class BankDemo { public static void main (String[] args) { BankAccount savings = account SavingsAccount ("Bob Saget","123456789789"); //error here System.out.println ("Enter your account balance $:"); System.out.println ("Enter the annual interest rate:"); System.out.println ("Enter the number of withdrawals:"); System.out.println ("Enter the number of deposits:"); System.out.println (savings); System.out.println ("Account Balance $:" + savings.getBalance()); System.out.println ("Withdraw:" + savings.getNumWithdrawals()); System.out.println ("Deposit:" + savings.getNumDeposits()); System.out.println ("Monthly Process:" + account.monthlyProcess()); //error here }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!