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

  Write a method that takes a string as input and returns

Write a method that takes a String as input and returns the reverse of that String. Then write a second method that uses the first method to test whether or not an input String is a palindrome.

  Typical industrial engineering problem

A company manufactures two products, A and B. Product A can be sold for $145 per unit and B for $75 per unit. Management requires that at least 1850 units be manufactured each month.

  Write a statement that prints the number of characters

Write a statement that prints the number of characters in a String object called myString. Write statements to prompt for and read user's age using Scanner variable

  Compare swing java gui components to awt components

Compare Swing Java GUI components to AWT components. Explain at least one way the components are similar and at least one way they are different.

  Write a script that simulates a casino machine

Write a script that simulates a casino machine. To play a single round on the machine user pays $ 5. Now when the user start the machine, the machine rolls a pair of dice

  Working with numeric variables

Create a Java program for the following application. (it is in the second chapter of my Intro to "Java Programming" book (Murach 4th Edition)It involves1. working with numeric variables2.using the System.out object to print output to console

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Describe how a semaphore can be used to act like a lock.

The loop should execute until a "shutdown" flag is set to true on the runnable object executing in the thread.

  Write application that will keep track of number of customer

Write Java application that will keep track of a number of customer's purchases at local discount stand. Customers will know exactly how many items they will purchase, so use an appropriate loop on this lab and let's keep the rules simple.

  Write a program that reads in a text file and then computes

Write a program that reads in a text file and then computes and prints a table of letter frequencies. For example, if the file is the text of "A Tale of Two Cities", found in the file at data/tales.txt , the program will print

  Imagine that you have been assigned

Imagine that you have been assigned to implement a sorting program. The goal is to make this program general purpose, in that you don't want to define in advance what record or key types are used

  Program that allows two players to play tic-tac-toe

Implement a program that allows two players to play tic-tac-toe. Draw the game grid and an indication of whose turn it is (X or O). Upon the next click, check that the mouse click falls into an empty location,

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