subject

/* Work to do: 1) add toString method to BankAccount and SavingsAccount classes
2) Override the withdraw() in SavingsAccount so that it will not withdraw more money than is
currently in the account.
3) Provide constructors for SavingsAccount
4) Add this feature to SavingsAccount: If you withdraw more than 3 times you are charged $10 fee
and the fee is immediately withdrawn from your account. once a fee is deducted you get another 3 free withdrawals.
5) Implement the Comparable Interface for SavingsAccount based on balance.
Once you finish adding/modifying the code make sure it compiles and run.
Submit your modified InheritanceTester. java file to the assignment folder
Warning: Notice that there are 3 classes in one file, and only one of them is public,
and this public class name should be the filename. Be careful about the { } braces.
*/
public class InheritanceTester{
public static void main(String[] args){
SavingsAccount tom = new SavingsAccount(5000);
SavingsAccount kim = new SavingsAccount();
tom. withdraw(100);tom. withdraw(1000);tom. withdraw(200);
kim. withdraw(100);//should print error message: Insufficient balance
System. out. println(tom);//should print $3700 as balance
tom. withdraw(1000);
System. out. println(tom);//should print $2690 as balance, and fee charged
tom. withdraw(1000);
System. out. println(tom);//should print $1690 as balance
}
}
class BankAccount
{
private double balance;
public BankAccount()
{ balance = 0; }
public BankAccount(double initialBalance)
{ balance = initialBalance; }
public void deposit(double amount)
{ balance = balance + amount; }
public void withdraw(double amount)
{ balance = balance - amount; }
public double getBalance()
{ return balance; }
}
class SavingsAccount extends BankAccount{
//add code here.
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
Consider how gaming consoles initially relied on joysticks and joypads and then made the switch to modern gaming controls, which include analog sticks, buttons and switches, touch controls, accelerometers, motion controls, etc. name at least two kinds of gaming experiences that are possible with these new control devices but were not possible on original joysticks. explain how new technologies made this newer game style possible.
Answers: 1
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
question
Computers and Technology, 24.06.2019 09:00
Why might you chose to crest a function resume
Answers: 1
question
Computers and Technology, 24.06.2019 10:00
What did i do wrong with this const discord = require('discord.js'); var bot = new discord.client(); const token = 'ntm3mjcxmtu1mjg3ote2ntq2.dyogew.dpfiwfpuifzuzvifop-csuxasnm' const prefix = "! " bot.registry.registergroup('simple', 'simple'); bot.registry.registerdefaults(); bot.registry. + '/commands'); bot.on('message', message => { if(message.content == 'hi! ') { message.channel.send ('@everyone sup, how is @everyone day going'); } if(message.content == 'h3lp') { message.channel.send ('dose not have any commands yet'); } bot.on('ready', function() { console.log("ready") }); bot.login(token);
Answers: 1
You know the right answer?
/* Work to do: 1) add toString method to BankAccount and SavingsAccount classes
2) Override t...
Questions
question
Mathematics, 08.06.2020 04:57
question
Social Studies, 08.06.2020 04:57
question
Mathematics, 08.06.2020 04:57
question
Biology, 08.06.2020 04:57
question
Mathematics, 08.06.2020 04:57
question
Computers and Technology, 08.06.2020 04:57
question
History, 08.06.2020 05:57
Questions on the website: 13722363