Write an inflation calculator. Input should be amount, rate of inflation and number of years. Output should be the future value of the amount.
-Java need help please
//InflationCalculator.java import java.util.Scanner; public class InflationCalculator { public static void main(String[] args) { double amount, rate; int years; Scanner scanner = new Scanner(System.in); System.out.print("Enter amount: "); amount = scanner.nextDouble(); System.out.print("Enter inflation rate: "); rate = scanner.nextInt(); System.out.print("Enter number of years: "); years = scanner.nextInt(); for(int i = 0;i<years;i++){ amount = amount + (amount*rate/100.0); } System.out.println("Final amount = "+amount); } }
Get Answers For Free
Most questions answered within 1 hours.