Create four classes

Assignment Help JAVA Programming
Reference no: EM131862

Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.

1. For the Account class, create:

  • two protected variables for the account number and the account balance.
  • two get methods - one for the account number and one for the account balance
  • two set methods - one for the account number and one for the balance.
  • a constructor that requires an account number and sets the balance to 0.
  • a method to override the toString() method which returns a String containing: Account # = < account number> Account Balance = <account balance> where <account number> is the object's account number and <account balance> is the object's account balance.
  • an abstract computeInterest() method that takes one integer argument and returns a double.
  • Do not allow either the account number or the balance to be set to a negative number.

2. The Checking class will be a subclass of Account. For the Checking class, create:

  • a method to override the toString() method which returns a String containing: "Checking" , the account number, and the account balance. Do not print the interest earned as part of toString().
  • a constructor that takes an account number as an argument and calls the superclass constructor passing this account number.
  • a method to implement the abstract computeInterest() method of the superclass. This method takes one argument for the interest period and returns the interest earned. The interest earned is 2 % of the balance over $700 times the interest period. The interest period is passed as an argument to the computeInterest() method. For example, the interest on $3000 at 2% for three years is (3000 - 700) times .02 times 3 or 138.

3. The Savings class will be a subclass of Account. For the Savings class, create:

  • an additional private variable to hold the interest rate.
  • a get and set method for the interest rate. Do not allow the interest rate to be set to a negative number.
  • a method named toString() that overrides the toString() method of the Object class. This method should return "Savings", the account number, the account balance and the interest rate. Do not print the interest earned as part of toString().
  • a constructor with two arguments - the account number and the interest rate. This constructor calls the superclass constructor passing the account number.
  • a method to implement the abstract computeInterest() method of the superclass. This method takes one argument for the interest period and returns the interest earned. The interest is calculated as (1 + interest rate)period times the balance minus the balance. The interest period is passed as an argument to the computeInterest() method. For example, the interest on $6000 at 2% for three years is (1.02)3 * 6000 - 6000 or 367.

4. For the AccountArray class, create:

  • a main() method.
  • an array to store 10 objects of either the Savings or Checking class. Use 2% (.02) for the savings account rate. Use account numbers 100 through 109. Use initial balances of 1000 through 10000.
  • a for loop that will instantiate 5 objects of the Savings class and 5 objects of the Checking class. Store these objects in a single array created above.
  • a for loop that prints the data in all 10 objects of the array using the overridden toString() method and also prints the interest amount computed for each object. Use 3 for the period.

Reference no: EM131862

Questions Cloud

Calculate the component voltages : Calculate the component voltages for the following series resonant RLC circuit
Calculate the regression equation : Calculate the regression equation for this data
Write an sql query : Write an SQL query to get the author of the book "The Alchemist"
Analyzing a case study - a swot analysis : Detailed analysis of a case study should include eight areas The history, development, and growth of the company over time
Create four classes : Create four classes: Account.java, Checking.java, Savings.java, and AccountArray.java.
Evaluate the maximum profits : Evaluate the maximum profits that Greentown can earn and the customer mix and quantity by which that profit will be achieved.
Case study:moet hennessy louis vuitton : Case study:Moet Hennessy Louis Vuitton
Sensitivity of mammography : Determine and interpret the sensitivity of mammography.
Hardware support to memory management : Study any two multicore processor architecture and discuss the following features briefly

Reviews

Write a Review

JAVA Programming Questions & Answers

  Communication with an smtp server

Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Loops and files

Convert an algorithm using control structures into Java and write a while loop

  File integrity checker - tripwire

Write a program that will perform some of the basic tasks accomplished by a file integrity checker such as Tripwire.

  Rock-paper-scissors :- java problem

Design decision marks are based on how you implemented our programs/classes.

  Data structures and algorithms

Code analysis and programming.

  Solving programming problems

Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Socket programming in java: tcp

In this project we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous service requests in parallel.

  Implement the lexical and syntactic analysis

Implement the lexical and syntactic analysis of Minifun programming language.

  Write a program to register students for a college

Students have names, addresses and courses. Implement the interface class RegisterStudent. RegisterStudent has one method, public boolean register, which returns the boolean value of true or false if the student is successfully registered for the ..

  Build the gui layout of the game

Build the Build the GUI layout of the game in java.

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