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, 21.06.2019 22:00
Problems: 1. using textbooks, reference books, and internet as your source of research, draw the following microprocessor microarchitectures i. intel 8086 ii. motorola 68000 i atmel atmega32 iv. mips single cycle v. arm cortex-m3 write an hdl module for a hexadecimal seven-segment display decoder. the input is 4-bit binary representing a hex number (0-f), and the output is 8-bit seven segment display bits (a-h). thus, the decoder must handle the digits 10 - 15 to display a-f respectively, in addition to 0-9 numbers. 2. design a 4-bit left and right rotator (both outputs). first sketch schematic diagrams of your design. then implement your design using hdl coding. 3. 4. design a modified priority encoder that receives an 8-bit input, a7: 0 and produces a 3-bit output, y2o. y indicates the most significant bit of the input that is true. y should be 0 if none of the inputs are true. give a simplified boolean equation, sketch a schematic, and write an hdl code. 5.write an 8: 1 multiplexer module called mux8 with selection inputs s, data input d, and data output y. data input (d) and data output (v) are 32-bit wide
Answers: 3
question
Computers and Technology, 22.06.2019 01:50
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy.html.erb" and “.html.erb" files in appropriate locations.
Answers: 3
question
Computers and Technology, 22.06.2019 16:30
What type of file does a cookie place on web site visitors' computers so that web site managers can customize their sites to their visitors' preferences?
Answers: 1
question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
You know the right answer?
/* Work to do: 1) add toString method to BankAccount and SavingsAccount classes
2) Override t...
Questions
question
Mathematics, 22.01.2021 07:20
question
Mathematics, 22.01.2021 07:30
question
Chemistry, 22.01.2021 07:30
Questions on the website: 13722360