Unser erster Umwandler!

  • 7
  • Gesperrt
Du hast wahrscheinlich schon oft elektronische Umwandler oder Programme verwendet, um eine Menge in einer Einheit in eine Menge einer anderen Einheit umzurechnen. Zum Beispiel Dollar in Euro oder Meilen in Kilometer. Jetzt ist es an der Zeit, dass wir ein solches Tool programmieren. Konkret werden wir ein Programm schreiben, das eine Temperatur von Grad Celsius in Grad Fahrenheit umwandelt.
Du kannst diese Aufgabe nicht abschließen, weil du nicht angemeldet bist.
Kommentare (14)
  • Beliebt
  • Neu
  • Alt
Du musst angemeldet sein, um einen Kommentar schreiben zu können
Yusuf et Turki
Level 5 , Germany, Germany
27 Oktober 2022, 06:07
In Java intiger / intiger = intiger that means, the result from 9/5 = 1. But we need something double. So because of that we should calculate like that 9/5.0 = 1.8 . In this way we get the right answer.
Daniel Bergmann
Level 2 , Deutschland
11 Oktober 2022, 15:06
ihr müßt statt (9/5) -> 1.8 eingeben. Dann kommt die korrekte 105 statt 73 raus ;-)
Claudia Theiling
Level 18 , Lüneburg, Germany
24 Juni 2020, 21:06
Hello, I had the same problem. Only when I declared TF and TC as double the result was correct. But I can’t explain why! If I multiply an Integer with a double the result should be a double, shoudn’t it?
Saskia Schmidt
Level 4 , Zittau, Germany
2 März 2020, 13:50
Brauch dringend Hilfe, bis auf den letztn Punkt funktioniert alles. Aber sobald ich double Fahrenheit verwende ist das Programm falsch. Warum? Schließlich heißt es, dass Fahrenheit als double und nicht als integer genutzt werden muss.
Alex Vypirailenko Java Developer bei Toshiba Global Comme
4 März 2020, 08:51
Please use the Help section, if you are having issues with a particular task. Without the code, no one can see what the problem is and therefore no one can help.
Muhamed
Level 4 , Dortmund, Germany
22 Februar 2020, 21:46
"double Fahrenheit;" muss hier genutzt werden - should be used here
German Squiddlet
Level 2 , Munich, Germany
27 Januar 2020, 00:25
public static double celsiusInFahrenheitUmwandeln(int celsius) { return (celsius*9/5)+32; } this is correct. but gets refused.
Martin Eichler
Level 7 , Freiburg, Germany
3 Februar 2020, 03:51
Did you declare the fahrenheit variable as 'double' instead of 'int'?
Tilman Drößler
Level 4 , Munich, Germany
7 März 2020, 11:44
I could imagine you have an logical problem. It should work if you put 1.8 instead the 9/5. Or you can change the funktion. return(celsius*(9/5))+32;
Fabian GU
Level 11 , Stuttgart, Germany
10 März 2020, 10:55
I had the same problem, the program returned 105 instead of 105.8... You have to add an decimalpoint after --> 5 = 5.0 it should return the correct value.
BernhardH
Level 20 , Austria
23 Dezember 2021, 09:38
Because there are only int values in the formular it wil calculate a int result, so the ".8" is lost, even when it returns a double. When you use 1.8 instead of 9/5 it will work
Sebastian Meyer
Level 2 , Schwendau, Austria
14 November 2019, 17:18
why is the last point not correct?
Roman
Level 41
15 November 2019, 06:35
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
Olligame
Level 3 , Munich, Germany
14 Januar 2020, 12:25
you have to incorporate the value from above into the method and assign the value