Create four classes accountjava checkingjava savingsjava

Assignment Help JAVA Programming
Reference no: EM13347929

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: EM13347929

Questions Cloud

Design and implement a c program and structure diagram for : design and implement a c program and structure diagram for the subsequent specification.show writing and calling
Question 1a busy landscaping supplies company sells wood : question 1a busy landscaping supplies company sells wood chips for garden mulch. the mulch is sold by the cubic metre
Problem 1- customers with certain list patternsnbspproblem : problem 1- customers with certain list patternsnbspproblem descriptionnbsp you are provided with four tables in
Analyzing a case studyas just mentioned the purpose of the : analyzing a case studyas just mentioned the purpose of the case study is to let you apply the concepts youve learned
Create four classes accountjava checkingjava savingsjava : create four classes account.java checking.java savings.java and accountarray.java.1. for the account class createtwo
Question 1unfocused books is a discount retail bookshop : question 1unfocused books is a discount retail bookshop that has three departments non-fiction fiction and childrens
Excellent performance for lvmh in 2012 lvmh moeumlt : excellent performance for lvmh in 2012 lvmh moeumlt hennessy louis vuitton the worlds biggest luxury products group
Question 1 give illustrations of primary secondary and : question 1 give illustrations of primary secondary and tertiary prevention that will be used to reduce the damage
Questionsstudy any two multicore processor architecture and : questionsstudy any two multicore processor architecture and discuss the following features briefly.a bus architectureb

Reviews

Write a Review

 

JAVA Programming Questions & Answers

  Create a book class for the library application project

Create a Book class for the Library application project. In addition to properties of author and isbn, with setters/getters, the Book should override Object's base method "boolean equals(Object)" and have a "boolean validate()" method.

  Write java program to read present basic hourly wage

Write down a java program which will input 1. Read present basic hourly wage. Read in workers fist name and socond name.

  Build a simple text-based adventure game

Build a simple text-based adventure game. You can and probably should use our Missed Connections example as the foundation for your game.

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

  Using an array in java

Using an array in Java - have a list of keywords from a web service and have to print out the list of keywords on the screen with one keyword on each line. This is my code

  Write a java program that declares an array alpha of 50

Write a Java program that declares an array alpha of 50 elements of type double. Initialize the array so that the first 25 elements are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. O..

  Display an image of an apple on the screen

Display an image of an apple on the screen, then after 3 seconds automatically change the display to an orange.

  It inherits the functionality of super class

It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

  What value would be returned from call to its size() method

If a collection stores 5 objects, what value would be returned from a call to its size() method?

  Create a gui version of the game mini sudoku.

Each row has the numbers 1 to 6,Each column has the numbers 1 to 6,Each group of 2 rows by 3 columns also has the numbers 1 to 6.

  Question superclass and provide a different implementa

Add a method addText to the Question superclass and provide a different implementa- tion of ChoiceQuestion that calls addText rather than storing an array list of choices.

  Create a calculator function

This is the code for my trip planner,you need to figure out how to create a calculator function to enable users to calculate their own costs if they choose

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