View Single Post
  #1 (permalink)  
Old 07-18-2007, 06:55 PM
silvia silvia is offline
Member
 
Join Date: Jul 2007
Posts: 35
silvia is on a distinguished road
Error: unexpected type
Hi, I have tried every way I could think to correct this problem. This is the last of 13 errors I had to find debugging this assignment.

Code:
interest = annualInterest 12;
after compiling it, the error message said:

Code:
possible loss of precision found: double required: int
the declaring variables are

int price, downPayment, tradeIn, months, loanAmt, interest;
double annualInterest, payment;

under conversions there is this:

Code:
annualInterest =Double.parseDouble(inputAnnualInterest);
under calculations the line of code is
Code:
interest = annualInterest 12;
I tried putting "/" in front of 12, got an error. Tried putting parantheses around
(annualInterest 12) got an error. How to get int when there is a double. I determined from declared variable annualInterest was the double. So here is what I tried next:

Code:
interest = (double = (annualInterest / 12));
got an error back
Code:
unexpected type required: variable found : class interest = (double = (annualInterest / 12)); ^(under the d in double) 1 error

My understanding is everything in the ( ) has to equate to an int and not double...since interest is an int. Must be close because the error message no longer says found: double required: int. It just says found:class required variable.

Maybe someone can clarify my understanding.

Thanks
Reply With Quote
Sponsored Links