Design an abstract class named bankaccount

Assignment Help JAVA Programming
Reference no: EM131374050

Java - BankAccount and SavingsAccount-

Design an abstract class named BankAccount to hold the following data for a bank account: -Balance -Number of deposits this month -Number of withdrawals -Annual interest rate -Monthly service charges The class should have the following methods: Constructor: The constructor should accept arguments for the balance and annual interest rate.

Deposit: A method that accepts an argument for the amount of the deposit. The method should add the argument to the account balance. It should also increment the variable holding the number of deposits. Withdraw: A method that accepts an argument for the amount of the withdrawal. The method should subtract the argument from the balance. It should also increment the variable holding the number of withdrawals.

calcInterest: A method that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance.

This is performed by the following formulas: Monthly Interest Rate = (Annual Interest Rate / 12) Monthly Interest = Balance * Monthly Interest Rate Balance = Balance + Monthly Interest

monthlyProcess: A method that subtracts the monthly service charges from the bal- ance, calls the calcInterest method, and then sets the variables that hold the number of withdrawals, number of deposits, and monthly service charges to zero.

Next, design a SavingsAccount class that extends the BankAccount class. The SavingsAccount class should have a status field to represent an active or inactive account. If the balance of a savings account falls below $25, it becomes inactive. (The status field could be a boolean variable.) No more withdrawals can be made until the balance is raised above $25, at which time the account becomes active again. The savings account class should have the following methods:

withdraw: A method that determines whether the account is inactive before a withdrawal is made. (No withdrawal will be allowed if the account is not active.) A withdrawal is then made by calling the superclass version of the method.

deposit: A method that determines whether the account is inactive before a deposit is made. If the account is inactive and the deposit brings the balance above $25, the account becomes active again. The deposit is then made by calling the superclass version of the method.

monthlyProcess: Before the superclass method is called, this method checks the number of withdrawals. If the number of withdrawals for the month is more than 4, a service charge of $1 for each withdrawal above 4 is added to the superclass field that holds the monthly service charges. (Don't forget to check the account balance after the service charge is taken. If the balance falls below $25, the account becomes inactive.)

Reference no: EM131374050

Questions Cloud

Determine the nutritional information : Where can people determine the nutritional information of their actual serving size if it is different from that given on the food label? Why have beverage manufacturers already made such changes to their labels even though the changes will not be..
How are furnace clearances determined : Can mastic be used for duct board that will be used as plenums ?
Identify the structures that are unique : Compare organelles in both plant and animal cells. Identify the structures that are unique to each type of cell? HINT:There areONLY four (4)unique structures for plant cells and ONLY two (2) unique structures for animal cells.
What is the minimum current rating for the disconnect switch : An electric furnace has a minimum circuit ampacity rating of 50 A. What is the minimum current rating for the disconnect switch?
Design an abstract class named bankaccount : Design an abstract class named BankAccount to hold the following data for a bank account: -Balance -Number of deposits this month -Number of withdrawals -Annual interest rate -Monthly service charges.
Difference between and haploid number and a ploidy number : What is the difference between and haploid number and a ploidy number, and how do you determine them?
How is the power wire sized for an electric furnace : How is the power wire sized for an electric furnace?
Root system to the leaves within a plant : Which properties of water allow for it to be transported from the root system to the leaves within a plant?
How can an electric baseboard heater be cleaned : Why are hydronic furnaces popular in geographical areas that do not require air conditioning?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Use of width and height attributes in an element

Which of the following will occur if you do not use the width and height attributes in an element?

  Write a new queue method called movetorear

Write a new queue method called moveToRear() that moves the element currently at the front of the queue to the rear of the queue. The element that was second in line will be the new front element. Do this using methods q.enqueue() and q.dequeue()

  Write a program in java that uses a method called quadrant

JAVA) write a program IN JAVA that uses a method called quadrant that accepts as parameters a pair of double values representing an (x, y) point and returns the quadrant number for that point. Recall that quadrants are numbered as integers from 1 to ..

  Subtyping and exceptions

In Java, a method that can throw an exception (other than from a subclass of Error or RuntimeException) must either catch the exception or specify the types of possible exceptions with a throws clause in the method declaration. For example, a meth..

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Create game in which the running back has to carry the ball

The Tackle-Breaking Running Back, you will: Use and work with Keyboard events - objective of this assignment is to create a game in which the running back has to carry the ball to the goal line.

  Create and implement class called date to store month

Create and Implement the class called Date which has data members to store month (as a number), day, year, and name of month.

  Write an application that prompts a user for a month

Write an application that prompts a user for a month, day, and year. Display a message that specifies whether the entered date is not this year, in an earlier month this year, in a later month this year, or this month.

  Fixing errors in a java program

You coded the following on line ten of the class MyApplet.java:

  Services based on service orientation analysis

301041 Service Oriented Architecture - Include the installation guide in detail and also instructions for how to use the services and the client. Include the code only as a zipped, soft copy to be submitted through vuws. The code should also be upl..

  What is overloading and what is overriding

What is overloading and what is overriding? Wrtie JAVA code code to explain it.

  Program that tests if an input string is a palindrome

Write a recursive method that takes a string as argument and returns the reverse of the string (given the argument "Horse" your method should return the string "esroH").

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd