Question: Lab 1 0 : Create a project called Continuallnterest _ FirstName _ LastName or Lab 1 0 _ FirstName _ LastName. Remember to include comments

Lab 10: Create a project called Continuallnterest_FirstName_LastName or
Lab10_FirstName_LastName. Remember to include comments describing your program. A key
component of this lab should be comments describing the methods used.
The steps provided are broken down into a bottom-up implementation. Methods implemented in
earlier steps will be used in later steps.
First, implement a method that will handle the calculation of the compound interest. This method
will take a double for the principal amount, a double for the interest rate, and an int for the
number of years. This method will return a double for the final amount.
In the body of this method, use the following formula to calculate compound interest:
A=P(1+r)t
where P is the principal amount, r is the interest rate, t is the number of years, and A is the final
amount. Be careful about the order of operations in this formula.
Next, implement a method that will handle printing the output to the console with proper
formatting. This method will take an int for the number of years and a double for the final
amount. This method will not return anything. The final amount must be formatted to two
decimal places.
In the main method, declare a Scanner that accepts input from the keyboard. Declare variables
for the principal amount, interest rate, number of years, and final amount. The data types should
match what is expected for the other methods in this program.
Make requests to the user to enter the principal amount, interest rate, and number of years. The
interest rate will be requested as a percent, so make sure this is converted to a decimal before
performing any calculations.
Write a for loop to go through each year of the loan. This loop will start with year 0 and end with
the year the user input. Within this for loop, do the following:
Call the first method implemented to calculate the final amount. Make sure the principal
amount, interest rate, and the current year (based on the for loop) are passed into this
method and that the result of calling this method is assigned to the final amount.
Call the second method implemented to print the output to the console. Make sure the
current year and final amount are passed into this method.
Lab 1 0 : Create a project called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!