Generation

testsSun, 24 Mar 2024

If you invest 𝑃 pulas at π‘Ÿ percent interest rate compounded annually, in 𝑁 years, your investment will grow to 𝑃 (1 + π‘Ÿ 100) 𝑁 pulas. Write a Java program that reads 𝑃 and π‘Ÿ from the keyboard and displays the value of your investment for the first five years; similar to the following output (here 𝑃 = P100000.00, π‘Ÿ = 2%). Hint. You can use a variable for each of the five years. Investment: P100000.00 Interest rate: 2.00% ****************************** N(years) Total ****************************** 1 102000.00 2 104040.00 3 106120.80 4 108243.22 5 110408.08 Your program should be called Investment.java.

mport java.util.Scanner; public class Investment { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter the amount of money you want to invest: "); double amount = input.nextDouble(); System.out.println("Enter the interest rate: ")

Questions about programming?Chat with your personal AI assistant