+ 1

HELP PLEASE

Beginner needs help. What is wrong with my code? using System; namespace Bastun { class Program { static double FahrenheitToCelsius(int farh) { return temp; } public static void man(string [] args) { Console.WriteLine("Enter Fahrenheit temperature:"); double Celsius; double fahrenheit = Convert.ToDouble(Console.ReadLine()); Celsius = (fahrenheit - 32) * 5 / 9; do { Console.WriteLine("What temperature you wish to have? (NB fahr) : "); if (Celsius > 77) { Console.WriteLine("WARNING!! " + Celsius + "too hot! "); Console.WriteLine("turn down the temperature"); Console.ReadLine(); } if (Celsius < 73) { Console.WriteLine("Not ready yet" + Celsius + "Turn up the temperature"); Console.ReadLine(); } else if (Celsius == 75) { Console.WriteLine("Perfect temperature! Enjoy"); Console.ReadLine(); } } while (Celsius < 73 || Celsius > 77); Console.WriteLine(" It is " + Celsius + "Enjoy"); Console.ReadKey(); } } }

30th Aug 2021, 12:47 PM
Fo Ya
Fo Ya - avatar
15 Respostas
+ 2
Fo Ya It would be better if you can share a saved code link instead of raw text code like that. With code bit we can refer line number, and it's more comfortable to test. Here's how to share a code bit link https://www.sololearn.com/post/75089/?ref=app
31st Aug 2021, 9:58 AM
Ipang
+ 1
You have unused method FahrenheitToCelcius. Inside it you return <temp> which is undefined. You don't have a valid Main method to get your code to run, the Main method signature was like this ... public static void Main (string [] args)
30th Aug 2021, 1:31 PM
Ipang
+ 1
Look at the code again, where it says ... public static void man(string [] args) It should be ... public static void Main(string [] args)
30th Aug 2021, 8:51 PM
Ipang
+ 1
thank you! I changed it a little bit and I managed o get it to work, but it doesn't work when i put a new temperature. does any one knows how to fix it. this is my code: using System; namespace Bastun1 { class Program { public static double FahrToCel(int fahr) { double cel = (fahr - 32) * 5 / 9; return cel; } public static void Main(string[] args) { double celsius; Console.WriteLine("Enter Fahrenheit temperature: "); double fahrenheit = Convert.ToDouble(Console.ReadLine()); celsius = (fahrenheit - 32) *5 / 9; Console.WriteLine("the converted Celsius temperature is: " + celsius); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); do { if (celsius > 77) { Console.WriteLine("WARNING!! " + celsius + " is too hot! turn down the temperature"); Console.ReadLine(); } if (celsius < 73) { Console.WriteLine(celsius + " NOT READY YET. Turn up the temperature"); Console.ReadLine(); } else if (celsius == 75) { Console.WriteLine("Perfect temperature! Enjoy"); Console.ReadLine(); } } while (celsius < 73 || celsius > 77); Console.WriteLine(" It is " + celsius + " Perfect temperature! Enjoy"); Console.ReadKey(); } } }
31st Aug 2021, 9:15 AM
Fo Ya
Fo Ya - avatar
+ 1
You are accessing SoloLearn web? The link only opens in SoloLearn mobile app ...
31st Aug 2021, 10:18 AM
Ipang
+ 1
+ Make a new C# code in Code Playground + Save it (important) + After saving, copy the link from browser address bar. + Paste the code link where you want it.
31st Aug 2021, 10:29 AM
Ipang
31st Aug 2021, 10:35 AM
Fo Ya
Fo Ya - avatar
0
Humm i dont get it!šŸ˜”
30th Aug 2021, 8:47 PM
Fo Ya
Fo Ya - avatar
0
ok, the link you sent doesn't work!
31st Aug 2021, 10:17 AM
Fo Ya
Fo Ya - avatar
0
I understand, thnx
31st Aug 2021, 10:25 AM
Fo Ya
Fo Ya - avatar
0
The code works, what is the problem?
31st Aug 2021, 11:39 AM
Ipang
0
It works but i doesā€™t work when i write a new temperatue when its too hot or when its cold.
31st Aug 2021, 11:46 AM
Fo Ya
Fo Ya - avatar
0
Check line 43, you might need to replace || with &&. Also you could give comment to the while statement to enable us understand it better.
31st Aug 2021, 12:09 PM
Adewale Isaac
Adewale Isaac - avatar
0
I chenged it to && but it accepts the wrong temperature! Something is still missing
31st Aug 2021, 1:45 PM
Fo Ya
Fo Ya - avatar
0
Hello
31st Aug 2021, 3:11 PM
Joshua Prince . M