Question

In: Computer Science

What would you have to change in savings account for the abstract method to work in...

What would you have to change in savings account for the abstract method to work in Java?

Solutions

Expert Solution

If you have abstract method like deposit(),  withdraw() and applyInterest() method

Then to implement these method you can change the implemention like as

1) deposit have no charge

2) withdraw is free for 5 transaction and then deduct balance 1$( or as you wish) for each transaction after 5 transaction

3) implement applyInterest() or your abstract method in Account class or super class of SavingAccount class

apply the interest on balance as per given rate.

These change you can made in the implementation of your abstract method

For example

 public void deposit(double amount)
   {
       balance += amount; 
   }
public void withdraw(double amount)
   {
       if(countWithdraw<=5){
             balance -= amount; 
       }
       else{
             balance -= amount-1;
       }
       countWithdraw++; 
   }

public void applyInterest(){

balance+=monthlyInterest;//as per your choice

}

Please let me know if you have any doubt or modify the answer, Thanks :)


Related Solutions

Would you rather have a savings account that pays 5% compounded annually, or an account that...
Would you rather have a savings account that pays 5% compounded annually, or an account that pays 5% compounded monthly? Be sure to explain your position here.
Explain whether you would you rather have a savings account that paid interest compounded on a...
Explain whether you would you rather have a savings account that paid interest compounded on a monthly basis or compounded on an annual basis? Why? Describe what an amortization schedule is and its uses. Explain the purpose of an amortization schedule. Interest on a home mortgage is tax deductible. Explain why interest paid in the early years of a home mortgage is more helpful in reducing taxes than interest paid in later years. Explain the difference between an ordinary annuity...
If you deposit $12,123 dollars into a savings account, what interest would you need to be...
If you deposit $12,123 dollars into a savings account, what interest would you need to be earning to have $16,642 dollars in the same account 4 years later? Answer as a percent and to the nearest hundredth of a percent as in xx.xx % and enter without the percent sign.
if you deposit 10,697 dollars into a savings account, what interest would you need to be...
if you deposit 10,697 dollars into a savings account, what interest would you need to be earning to have 19,962 dollars in the same account 4 years later? answer as a percent to the nearest hundredth of a percent as in xx.xx %
You currently have $2,500 in your savings account. You would like to have $10,000 five years...
You currently have $2,500 in your savings account. You would like to have $10,000 five years from today. How much must you deposit in equal amounts at the end of each month for the next five years in order to reach your goal at an interest rate of 9% per year, compounded monthly?
Suppose you have a savings account earning 4.8% APR. you deposit $50 in the account at...
Suppose you have a savings account earning 4.8% APR. you deposit $50 in the account at the end of each week. What is the balance after 4 years
What is the formula to calculate how much a savings account would be worth if the...
What is the formula to calculate how much a savings account would be worth if the initial balance is $1,000 with monthly deposits of $75 for 10 years at 4.3% annual interest compounded monthly? What is the formula result? You want a savings account to grow from $1,000 to $5,000 within two years. Assume the bank provides a 3.2% annual interest rate compounded monthly. What is the formula to calculate how much you must deposit each month to meet your...
Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return...
Create an abstract class DiscountPolicy. It should have a single abstract method computeDiscount that will return the discount for the purchase of a given number of a single item. The method has two parameters, count and itemCost. Derive a class BulkDiscount from DiscountPolicy. It should have a constructor that has two parameters minimum and percent. It should define the method computeDiscount so that if the quantity purchased of an item is more then minimum, the discount is percent percent.
Suppose You have a savings account earning 4.8% APR and you want to have 1000 at...
Suppose You have a savings account earning 4.8% APR and you want to have 1000 at the end of 4 years. How much should you deposit each month to obtain this goal
You have just received an endowment and placed this money in a savings account at an...
You have just received an endowment and placed this money in a savings account at an annual rate of 13.58 percent. You are going to withdraw the following cash flows for the next five years. End of year 1.   $7,512 2.   $8,140 3.   $4,455 4.   $3,122 5.   $1,857 How much is the endowment that you received? Round the answer to two decimal places.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT