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

  Implement an inheritance hierarchy based on the following

Implement an inheritance hierarchy based on the following specifications for Account class, Checking Account class, and Savings Account class Methods: processDeposit ( ) - accepts a single double parameter containing the deposit amount. Updates the ..

  Video store application

Prepare an object-oriented program in Java for a video store application with the subsequent

  Write a helloworld program

Write a helloworld program by using Java programming language.

  Test plan outline a test plan for a substantial real-life

test plan outline a test plan for a substantial real-life system of your choosing. some possible examplesbullbaggage

  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.

  Declare identifiers for grade point and letter grade

This program focuses on some basic elements of interactive programming as well as basic programming practices. Declare identifiers for grade point and letter grade. The grade point can be either an integer or a double

  Employee type and the number of hours

Write a program that calculates the salary for the employee. The hourly rate for permanent staff (P) is 200, contract staff (C) is 150 and temporary staff (T) is 100. The program accepts the employee type and the number of hours the employee work.

  The java code conventions

The database must be able to retrieve client information and display it on the screen for a specific telephone number match. The program must be well commented and documented using javadoc. The program must conform to the Java Code Conventions

  Splash page designed for an app called super foods

Splash page designed for an app called Super Foods. Attached is the skeleton app

  Calculate the final grade

write must ask the user to input the percent score for each of these items then calculate the final grade.

  A class for counting the number of people

Specification: A class for counting the number of people in a room. This might be used to control how many people are allowed into a club with a doorman.

  Javas drawing capabilities

This week, we will be learning to use some of Java's drawing capabilities. The Graphics class provides methods for drawing many different shapes, using different colors, and for drawing strings using different fonts.

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