Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

@override public int withdraw(int amountToWithdraw) if (getBalance() - amountToWithdraw < -100_000) return getBalance() int newBalance = super.withdraw(amountTowithdraw) if (newBalance < 0 && newBalance > -100_000

@override

public int withdraw(int amountToWithdraw)

if (getBalance() - amountToWithdraw < -100_000)

return getBalance()

int newBalance = super.withdraw(amountTowithdraw)

if (newBalance < 0 && newBalance > -100_000

newBalance -= 10

return newBalance;

And my superclass method that im trying to override is

public int withdraw(int amountTowithdraw)(

int newBalance = this.balance - amountToWithdraw

if (newBalance >= 0

this.balance = newBalance

return newBalance;

I made sure that they lined up correctly and both were public but I keep getting the same error of checking account must override withdrawint make sure access for the method is public why?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions