I am writting a code to calculate the total payments of a car with interest. Also calculating the monthly payments. I keep getting errors, saying that i am not declaring price and rate...how do you declare them to some number?

this is my program.

```
public static void main(String[] args)
{//start main method
double price;//price of the car.
double rate; //the rate of interest in decimal form.
double total; //the total paid over the course of two years.
double mpayments; //monthly payments.
price=double num;
rate=double dnum;
total = (num) * (dnum) * 2;//to calculate the total price
mpayments = (total) / 24;//to calculate the monthly payments
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter the Price of the Car");
price=keyboard.nextDouble();
System.out.println(num);
System.out.println("Enter Rate of Interest (ex: 4% is 0.04)");
rate=keyboard.nextDouble();
System.out.println(dnum);
DecimalFormat numf = new DecimalFormat("$#######.00");
System.out.println("Your Total Payments Over 2 Years is" + numf.format(total) + ".");
System.out.println("Your Monthly Payments are " + numf.format(mpayments) + ".");
}//end main method
```