JOptionPane typo

Posted 09 September 2013 - 10:15 PM

I have the typical miles per gallon assignment. And I don't want the homework done for me just curious what my errors are so far. I know I need to convert to int, and put the formula in later once I get that far. I am getting errors at the parts I bolded in Netbeans. This is my first semester so be gentile and don't think I am an idiot please

Re: JOptionPane typo

Re: JOptionPane typo

Posted 09 September 2013 - 11:51 PM

In the first error, check if your milesDriven variable is an int. The compiler is complaining about your types. The types must match. It is saying the variable you are assigning to expects a type 'a' but you are assigning type 'b'.

The second is a bit easier. This is not an actual error. It is just that some editors make sure you follow good practices. In this case, it is telling you about assigning a value to a variable that you never use, which makes the assigning pointless.

Finally, in this error, you have the extra comma following the null. Since the method takes more then one parameter, you probably need to supply more parameters. Hope this helps.

Re: JOptionPane typo

Posted 10 September 2013 - 05:57 AM

salazar, on 09 September 2013 - 11:51 PM, said:

In the first error, check if your milesDriven variable is an int. The compiler is complaining about your types. The types must match. It is saying the variable you are assigning to expects a type 'a' but you are assigning type 'b'.

The second is a bit easier. This is not an actual error. It is just that some editors make sure you follow good practices. In this case, it is telling you about assigning a value to a variable that you never use, which makes the assigning pointless.

Finally, in this error, you have the extra comma following the null. Since the method takes more then one parameter, you probably need to supply more parameters. Hope this helps.