Question: AP COMP SCI A: Given the following base class write a new class called MyAccount that will inherit from Account and have the following: It

AP COMP SCI A:

  1. Given the following base class write a new class called MyAccount that will inherit from Account and have the following:
    1. It will use a constructor to initialize the balance to $1000
    2. It will contain a method called interest that when called will allow the user to earn 1% interest on their current balance
    3. MyAccount will also contain a method to witdraw. MyAccount will only allow someone to withdraw from their account without a fee if their balance is over $100, otherwise it will charge a $.50 fee. It will not allow them to withdraw at all if the withdrawal would cause their balance to go below 0.

Note you do NOT need to write main for this, just the inherited class. Note also I don't want to see the word static anywhere in this class.

public class Account {

protected double balance;

public Account()

{

balance = 0;

}

public void deposit (double amount)

{

balance= balance +amount;

}

public void withdraw(double amount)

{

balance=balance-amount;

}

public void CheckBalance()

{

System.out.println("your balance is" +balance);

}

}

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!