I have a lab for java, i feel like this is an easy mistake that i'm overlooking, but plz help, the point is to mak e aprogram that calculates mortage
sorry for my poor style, these are the errors
import java.util.Scanner;
import java.text.DecimalFormat;
public class LoanProgram
{
Scanner console = new Scanner(System.in);
public static void main (String [] args)
{
int years;
double amount, rate, payment;
amount= getAmount();
rate = getRate();
years = getYears();
payment = findPayment (amount, rate, years);
displayPayment (payment);
}
public static double getAmount()
{
System.out.print ("Please enter the amount to be borrowed: ");
int a = console.nextDouble();
if (a < 0 || a > 100000)
{
System.out.print ("Invalid. Enter Amount: ");
a = console.nextDouble();
}
return a;
}
public static double getRate()
{
System.out.print("Please enter the annual interest rate as a percent: ");
int b = console.nextDouble();
if (b < 0 || b >100)
{
System.out.print ("Invalid. Number must be between 0 and 100. Enter again: ");
b = console.nextDouble();
}
return b;
}
public static double getYears()
{
System.out.print("Enter the length of the loan in years: ");
int c = console.nextDouble();
if (c < 0 || c > 100)
{
System.out.print ("Error. Please re-enter the years: ");
c = console.nextDouble();
}
return c;
}
public static double findPayment (double a, double b, double c)
{
return a*b*((Math.pow (b+1, c/12))/((Math.pow (b+1, c/12))-1));
}
public static double displayPayment (double x)
{
System.out.println(x);
}
}
sorry for my poor style, these are the errors
LoanProgram.java:25: possible loss of precision
found : double
required: int
years = getYears();
^
LoanProgram.java:32: non-static variable console cannot be referenced from a static context
int a = console.nextDouble();
^
LoanProgram.java:32: possible loss of precision
found : double
required: int
int a = console.nextDouble();
^
LoanProgram.java:36: non-static variable console cannot be referenced from a static context
a = console.nextDouble();
^
LoanProgram.java:36: possible loss of precision
found : double
required: int
a = console.nextDouble();
^
LoanProgram.java:43: non-static variable console cannot be referenced from a static context
int b = console.nextDouble();
^
LoanProgram.java:43: possible loss of precision
found : double
required: int
int b = console.nextDouble();
^
LoanProgram.java:47: non-static variable console cannot be referenced from a static context
b = console.nextDouble();
^
LoanProgram.java:47: possible loss of precision
found : double
required: int
b = console.nextDouble();
^
LoanProgram.java:54: non-static variable console cannot be referenced from a static context
int c = console.nextDouble();
^
LoanProgram.java:54: possible loss of precision
found : double
required: int
int c = console.nextDouble();
^
LoanProgram.java:58: non-static variable console cannot be referenced from a static context
c = console.nextDouble();
^
LoanProgram.java:58: possible loss of precision
found : double
required: int
c = console.nextDouble();
^
13 errors
----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.