Writing a inflation calc for class
import java.util.Scanner;
public class InflationCalculator {
public static void main(String[] args){
Scanner keyboard = new Scanner (System.in);
RateOfInflation rateObject = new RateOfInflation();
int cost, numberOfYears;
double rateOfInflation;
System.out.print("Enter the current cost of the item:");
cost = keyboard.nextInt();
System.out.println("Enter the expected inflation rate per year");
System.out.print("(Enter as a percentage and do not include the percent sign");
rateOfInflation = (keyboard.nextInt() * .01);
System.out.print("Enter the whole number of years in the future to project cost:");
numberOfYears = keyboard.nextInt();
rateObject.calcMethod(cost, numberOfYears, rateOfInflation);
}
RateOfInflation.java <---- Error
public class RateOfInflation {
public double calcMethod(int cost, int numberOfYears, double rateOfInflation){
int n = 0;
double answer;
while (n == numberOfYears){
answer = (cost * rateOfInflation) + cost;
n++;
System.out.println( answer );
}
}
}
}