You've probably used electronic converters or programs on many occasions to convert a quantity of one unit to a quantity of another unit. For example, dollars to pounds, or kilometers to miles. Now it's time for us to write such a tool. Specifically, we'll write a program that converts from degrees Celsius to degrees Fahrenheit.
Our first converter!
- 7
Locked
Comments (97)
- Popular
- New
- Old
You must be signed in to leave a comment
Anonymous #11031355
8 July, 12:42
(9.0 / 5) * celsius + 32 & (9 / 5.0) * celsius + 32
不然9/5是int类型
0
Anonymous #10830582
28 December 2021, 07:34
double fahrenheit = (1.8 * celsius) + 32;
return fahrenheit;
0
Anonymous #10830582
28 December 2021, 07:31
one must return ' return fahrenheit; NOT 'return 0;' GOOD LUCK
0
Dav
25 October 2021, 16:36
the decimal thing was strange, it reminds me of significant figures rules.
the return issue was interesting bc it stuck out to me, but a few tries landed me with 'what should I tell it to return if this method is called' (not sure if that is the correct thinking, but it worked.)
A little confused as to declaration of convertCelsiusToFahrenheit as it seems to do that within the creation of the composite type convertCelsiusToFahrenheit right after public static. the compiler didn't seem to like it if I didn't declare convertCelsiusToFahrenheit in the body. What is going on?...celcius seems fine as int..
0
Anonymous #10829459
8 October 2021, 15:31
quede cabezona
0
Erick Gonzalez.
24 August 2021, 02:51
yo saque' el resultado con otro metodo, pero no me lo tomo' como bueno, porque tenia que llamar al metodo. muy buen ejercicio.
0
Anonymous #10762391
17 August 2021, 13:41
In which lesson does it explain the variables double and return? Did I miss something? Im losing my mind!
0
David Cáceres
5 August 2021, 12:53
tough one, the decimals got me good,but still really instructive.
0
David Vidal
1 June 2021, 13:33
I do not understand why the value assignation ignores "(9 / 5)" part.
If I put 1.8 (the result of 9/5) It works fine!
+1
Yusuf el Turki
16 May 2021, 20:57
Ich habe die richtige Antwort (105.8) aber trotzdem hatte ich Warnungen. Also sei vorsichtig die vierte Besonderheit. Benutzen sie das result command richtig.
0