Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Purpose: Suppose you are working at a financial company. The company has an investment product that allows investors to save the same amount of money
Purpose: Suppose you are working at a financial company. The company has an investment
product that allows investors to save the same amount of money each month for up to months
with an annual interest rate of The interest is paid at the end of each month. The financial
company wants to develop an app to let potential users enter the amount they want to save
each month and display the account balance after and months.
This program will emphasize the following concepts:
Declaring and using variables
Declaring and using constants
Reading user input
Performing numeric operations
String concatenation to format output
Lesson: To prepare for performing the calculations, consider a simpler case: what if we only
allow investors to save for two months? Can you write a program to display the account balance
after each month?
Suppose an investor saves $ each month into the account for two months. Since the annual
interest rate is the monthly interest rate is
After the month, the value of the account becomes:
After the month, the value of the account becomes:
Your algorithm will include three major steps:
Get input from users how much they want to invest each month for two months
Calculate the balance after the month and display the result
Calculate the balance after the month and display the result
Task:
Create a new Java project titled LabFirstNameLastName.
You must include comments describing key parts of this program.
Declare a Scanner called input that accepts input from the keyboard.
Remember to include the proper import statement to use the Scanner class.
Declare a constant of type double called MONTHLYINTERESTRATE. Initialize this
final variable to the correct value.
Declare a variable of type double called monthlyDeposit. Initialize this variable to
the user will provide a value later
Declare another variable of type double called currentValue. Initialize this variable to
be monthlyDeposit. This is the variable to hold the account balance after each month.
Prompt the user to input how much they want to savedeposit each month. Use the
appropriate method of the Scanner class to assign the user's input to the
monthlyDeposit variable.
Perform the calculation for the account balance after each month and assign the value to
currentValue.
Display the account balance after and months as "After the XX month, the
account value is YY Note that will be either First, Second, Third, or Sixth, and YY
will be the corresponding balance.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started