Add the interest using (balance * interestRate / 12) addInterest() to add the monthly interest for each iteration 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 getBalance() to display the current balance (See sample) 45% 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. LiFiUnit4Ch13.java 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%) o Output header as per sample showing interest rate o Print the table using a for loop displaying the current month and calling:

The first 500 words of the assignment:

In this assignment, we are required to write a program that tracks an investment for one person based on the input of an interest rate. The initial balance of the investment should be $2,000, and the program should add the monthly interest to the balance and output it in table format.

To begin, we need to create a class called “Investment” with the following class variables and methods. First, we need to declare a class variable called “interestRate,” which will hold the annual interest rate. This variable will be used to calculate the monthly interest. We also need to declare a constant called “ACCOUNT_NUMBER,” which will hold the account number for the investment.

Next, we need to provide a class method that will be used to set the annual interest rate. This method will take the interest rate as a parameter and assign it to the “interestRate” class variable.

To initialize the investment object, we need to provide a two-parameter constructor that takes the account number and the initial balance as parameters. This constructor will assign the account number to the “ACCOUNT_NUMBER” constant and the initial balance to the instance variable called “balance.”

To update the balance based on the interest rate, we need to provide an “addInterest()” method. This method will calculate the monthly interest by multiplying the balance by the interest rate and dividing it by 12. Then, it will add the monthly interest to the balance to update it.

To display the current balance, we need to provide a “getBalance()” method. This method will return the current balance of the investment.

Now, let’s move on to implementing the main program. In the provided Java file “LiFiUnit4Ch13.java,” we need to do the following steps:

1. Instantiate an “investor1” object using the two-parameter constructor. We will pass the account number as 1001 and the initial balance as $2,000.

2. Get input from the user for the interest rate. The interest rate should be entered in the format of decimal (e.g., 0.08 for 8%).

3. Output a header as per the sample, showing the interest rate.

4. Use a for loop to iterate through each month and print the table. In each iteration, display the current month number and call the “addInterest()” method to update the balance. Then, call the “getBalance()” method to display the current balance.

By following these steps, we will be able to track the investment for one person based on the input of an interest rate. The program will calculate and display the monthly balance in table format.

Need your ASSIGNMENT done? Use our paper writing service to score better and meet your deadline.


Click Here to Make an Order Click Here to Hire a Writer