Project 4
Project 4
Problem Description:
Analysis:
The problem entails developing a program that assists users in understanding the growth
potential of their investments over time.
1. Input Gathering: The program prompts users to input the initial investment
amount and the annual interest rate as a percentage. This input is crucial for
determining the future value of the investment.
2. Calculation: Upon receiving the input, the program calculates the future value of
the investment for each year over a 30-year period. This calculation involves
1
converting the annual interest rate into a monthly rate and using it to compound
the investment over time.
3. Output Presentation: The program then presents the calculated future values in a
tabular format, displaying the investment's growth over the specified period. This
output allows users to visualize how their investment will evolve and make
informed decisions regarding their financial planning.
Overall, the program facilitates understanding of investment growth by providing a clear
and structured representation of future value projections based on user input.
Design:
1. Input Gathering: The program should prompt me to enter the investment amount
and validate that it's a positive number.
2. Interest Rate Input: Next, the program should prompt me to enter the annual
interest rate as a percentage and validate that it's also a positive number.
3. Calculation: After gathering the necessary information, the program should
calculate the monthly interest rate using the provided formula.
4. Future Value Calculation: Using the calculated monthly interest rate, the
program should compute the future value for each year from 1 to 30.
5. Output Display: Finally, the program should display the future value for each
year in a tabular format, providing a clear overview of the investment's growth
over time.
Coding: (Copy and Paste Source Code here. Format your code using Courier 10pts)
2
import java.util.Scanner;
// investment amount
double investmentAmount = PositiveDoubleInput(scanner, "Enter the amount invested:
");
3
for (int years = 1; years <= 30; years++) {
// Calculate future value for the current year
double futureValue = calculateFutureValue(investmentAmount, monthlyInterestRate,
years);
// Display future value with proper formatting
System.out.printf("%-7d%.2f\n", years, futureValue);
}
}