That looks OK - maybe the parens are already out of step before that code?
Also, I don't know what the data type for tempUnit is, but it's unusual to see a char as parameter for equals. char is an integer primitive type, for which == is appropriate. Read More
same remark: they indeed seem to be chars, not objects. second remark: you can simplify that code a bit:
public double getFahr()
if (tempUnit =='C') //assuming they are chars
} Read More
OK. got it
isn't a valid expression. You must specify the multiplication explicitly. It's just not one of the compiler's best error messages ;)
(ps no point having doubles for the results when the input (tempNum) is just a float. Read More
tempNum is a double primitive
testObj is an object of class Temperature
they are so different in kind that using == makes no sense - its like asking "is London equal to Tuesday?"
For `equals` you want to know if two Temperature objects are "equal", where it's up to … Read More
The only way to compare equality between objects of a class is to use the class's `equals` method - the very one that you are writing now!
But if you use getCels() to get the value of each Temperature in degrees Celcius then that value is a primitive double, so … Read More
Please mark this "solved" for our knowledge base. You should start a new thread if you run into any new problems.
J Read More