Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class BankAccount { private String owner; private double balance; public BankAccount ( String holderName, double originalBalance ) { owner = holderName; balance = originalBalance;
public class BankAccount
private String owner;
private double balance;
public BankAccountString holderName, double originalBalance
owner holderName;
balance originalBalance;
public void depositdouble amount
if amount
balance amount;
System.out.printlnYou have deposited: amount;
public void withdrawaldouble amount
if amount && balance amount
balance amount;
System.out.printlnYou have withdrawn: amount;
public String getOwner
return owner;
public double getBalance
return balance;
public class CheckingAccount extends BankAccount
private double insufficientFundPenalty;
public CheckingAccountString holderName, double originalBalance, double insufficientFundPenalty
superholderName originalBalance;
this.insufficientFundPenalty insufficientFundPenalty;
@Override
public void withdrawaldouble amount
if amount
if getBalance amount
super.withdrawalamount;
else
System.out.printlnYou don't have enough money, withdrawing all available funds and applying insufficient funds.";
super.withdrawalgetBalance;
amountgetBalance;
insufficientFundPenaltyamount;
public double getInsufficientFundPenalty
return insufficientFundPenalty;
public void checkProcessdouble amount
System.out.printlnAttempting to withdraw: amount;
withdrawalamount;
System.out.printlnBalance after withdrawal attempt: getBalance;
System.out.printlnThe insufficient fund penalty available: getInsufficientFundPenalty;
Im trying to create a checkingaccount class for bankaccount class,It suppose to withdraw all of user's money in account first, then starting withdraw the penaltyfund I set, but it not working
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started