Program that establishes two savings accounts

Assignment Help JAVA Programming
Reference no: EM13940909

Write a program that establishes two savings accounts with saver1 having account number 10002 with an initial balance of $2,000, and saver2 having account 10003 with an initial balance of $3,000. Set a common rate of interest at 5% per year. At the end of each month, update the balance by adding one month's interest to the balance, so that the balance compounds monthly. Print an output that displays the month number and the account number and the balance for each of the two accounts. Use month 0 to display the initial balances, month 1 to display the balances after the first month's interest, and so on. At the end of the year, display the total balance for both accounts combined, like this:

Output:

Monthly balances for one year with 0.05 annual interest:

Month Account # Balance Account # Balance
----- --------- ------- --------- -------
0 10002 2000.00 10003 3000.00
1 10002 2008.33 10003 3012.50
2 10002 2016.70 10003 3025.05
3 10002 2025.10 10003 3037.66
4 10002 2033.54 10003 3050.31
5 10002 2042.02 10003 3063.02
6 10002 2050.52 10003 3075.79
7 10002 2059.07 10003 3088.60
8 10002 2067.65 10003 3101.47
9 10002 2076.26 10003 3114.39
10 10002 2084.91 10003 3127.37
11 10002 2093.60 10003 3140.40
12 10002 2102.32 10003 3153.49

Final balance of both accounts combined: 5255.81

Use two classes, a SavingsAccount class and a Prog4 as your Driver class.

8

SavingsAccount.java class

In the SavingsAccount class, declare a class variable called annualInterestRate, an instance constant called ACCOUNT_NUMBER, and an instance variable called balance. Provide a two-parameter constructor to initialize the instance constant and instance variable, and provide accessors for the instance constant and instance variable. Provide an addMonthlyInterest method to update the balance, by adding (balance * annualInterestRate / 12) to the current balance.

You are also required to provide a class method that sets the annual interest rate.

Prog4.java class

In the Prog4 Driver class, instantiate the saver1 and saver2 objects. Set the annual interest rate at 0.05. Print the table heading lines. Use a for loop to print the initial account numbers and balances and the account numbers and balances each month after that month's interest has been added. After the last month's printout, compute and display the total of both balances.

Your driver should generate the following outputs:

Output:

Monthly balances for one year with 0.05 annual interest:

Month Account # Balance Account # Balance
----- --------- ------- --------- -------
0 10002 2000.00 10003 3000.00
1 10002 2008.33 10003 3012.50
2 10002 2016.70 10003 3025.05
3 10002 2025.10 10003 3037.66
4 10002 2033.54 10003 3050.31
5 10002 2042.02 10003 3063.02
6 10002 2050.52 10003 3075.79
7 10002 2059.07 10003 3088.60
8 10002 2067.65 10003 3101.47
9 10002 2076.26 10003 3114.39
10 10002 2084.91 10003 3127.37
11 10002 2093.60 10003 3140.40
12 10002 2102.32 10003 3153.49

Final balance of both accounts combined: 5255.81

Reference no: EM13940909

Questions Cloud

What would the price be if the company expected : What would the price be if the company expected a volume of 120,000 units and used a markup of 50%?
What type of special issue do juveniles face in adult prison : What types of special issues do juveniles face in adult prison? Do you agree that juveniles should be tried as adults for certain crimes? Be sure to support your argument with research and examples.
Marketing factors influencing decision making : A study into the marketing factors influencing that persuade the decision making of Chinese student
Determine the maximum force acting on the body : Determine the maximum force acting on the body, the velocity of the body when it is 1 m from the amplitude position and the time taken for the body to travel 0.3 m from the amplitude position.
Program that establishes two savings accounts : Write a program that establishes two savings accounts with saver1 having account number 10002 with an initial balance of $2,000, and saver2 having account 10003 with an initial balance of $3,000
Market segmentation on the basis of gender : Describe how market segmentation on the basis of gender influences and perpetuates established gender norms. In your response to this question, consider examples of gendered marketing and discuss the problems with this method from a critical persp..
Comparative advantage theory the product life cycle theory : Discuss the key differences among the comparative advantage theory the product life cycle theory and the transaction cost theory.
Problem regarding the conspicuous consumption : Conspicuous consumption is a key concern for critical strands of marketing and consumption studies. Describe what is meant by conspicuous consumption, and identify key authors who have written about this phenomenon. In your response to this questi..
Prepare common size balance sheets to be used : Prepare common size balance sheets to be used for vertical analysis for 2009 and 2008. Prepare common income statements to be used for horizontal analysis for Matt's Hats for 2007 to 2009.

Reviews

Write a Review

JAVA Programming Questions & Answers

  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.

  The project involves benchmarking the behavior of java

The project involves benchmarking the behavior of Java implementations of one of the following sorting algorithms, bubble sort, selection sort, insertion sort, Shell sort, merge sort, quick sort or heap sort. You must post your selection in the "Ask ..

  Java socket hello i need to this assignment done in net

hello i need to this assignment done in net beans . and i want comment in code .also screen shots of running program

  Creates a professorraing class consisting of professor ID

Write a program that creates a professorRaing class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfullness, and clarity. In a separate implementation class, allow the user to enter the values.

  Illustrate the power of java inheritance and polymorphism

Illustrate the power of Java inheritance and polymorphism. Your response to this question is in multiple parts. You will submit your answers as specified at the end of this question.

  Create a testrectangle class that tests both constructors

An overloaded constructor that takes integer width and height arguments, uses a separate method to check whether the width and height fall within the range between 0 and 30, and throws an exception if out of range.

  Java class that represents your favorite musical instrument

Create your own Java class that represents your favorite musical instrument. Your musical instrument class should have at least 3 constants, 4 private data fields, getters and setters for each private data field, a toString() method

  Develop a basic android weather application

Develop a basic Android "Weather Application". Your application should have a single view with a list of cities (see below) and the current temperature at that location.

  An elementary calculation yields the result

An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7..

  The license plate game and csv parsing

Resulting method will correctly estimate that there are two syllables in quokka and two syllables in springbok, though it does get the number of syllables

  Write a test program that creates an array

Write a test program that creates an array of ten strings, an array of ten integers, and an array of ten dates, and finds the largest string, integer, and date in the arrays.

  Java tv''s newest owner! java tv is the greatest tv channel

Java TV's newest owner! Java TV is the greatest TV channel ever, and it prides itself in its 24 hour interesting ' programming'. To help you run this channel you will need to write a  dynamic  program that uses  Data Lists  to store all its TV show i..

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