Program tracks an investment based on input of interest rate


Basic Requirements:

Write a program that tracks an investment for 1 person based on the input of an interest rate. The initial balance should be $2,000. The interest should be added to the balance and output in table format as shown in the supplied sample. Balance should keep increasing until goal is met. See sample for output sample.

Task:

o Instantiate an investor1 object using a two parameter constructor passing the account number 1001 and the initial balance of $2,000

o Get input for interest rate (in the format .08 for 8%)

  • Use class variable to set interest rate

o Get input for desired goal

o Output header as per sample showing interest rate

o Print the table using a for loop displaying the current month and calling:

  • addInterest() to add the monthly interest for each iteration
  • getBalance() to display the current balance (See sample)
  • Only output the first 12 months and the last 3 (See sample)
  • See hint below on way to possibly do this

o Print “Desired Goal met on month: ### with a balance of: $####.##

Task:

o Declare a class variable called interestRate (This will hold the annual interest rate)

o Declare a constant called ACCOUNT_NUMBER

o Declare an instance variable called balance

o Provide a class method that will be used to set the annual interest rate

o Provide a two parameter constructor to initialize the constant account number and balance

o Provide an addInterest() method to update the balance based on the interestRate entered in the driver

  • Add the interest using (balance * interestRate / 12)

Sample:

Your output will vary based on interest rate and goal entered. Notice how only the first 12 months and last 2 are printed.

695_Sample output.jpg

2068_Sample output on ineterest rate.jpg

Request for Solution File

Ask an Expert for Answer!!
Accounting Basics: Program tracks an investment based on input of interest rate
Reference No:- TGS01238234

Expected delivery within 24 Hours