I have one last thing to add to my assignment before im finished.
This is a part of my code:
static decimal FahrToCels(int fahrenheit) //Metod för konvertering av Fahrenheit(F) till Celsius(C)
{
decimal celsius = (decimal)((fahrenheit - 32) * 5) / 9; // Matematisk uträkning för F till C.
return Math.Round (celsius, 1); //Lagrar ett decimal tal avrundat till 1 decimal och lagrar i celsius
}
static void Main(string[] args)
{
Console.Write("Vänligen ange temperatur till bastun och tryck enter: "); //skriver ut meddelande
do
int fahr = int.Parse(Console.ReadLine()); // Omvandlar string och lagrar användarens inmatning i en int fahrenheit
decimal celsius = FahrToCels(fahr); // Metoden FahrToCels konverterar inmatad temperatur till celsius och lagrar i decimal celsius
As can be seen, ive created a method, that is later used after the user is told to enter degrees in fahrenheit. The method converts the entered number to celsius.
Now the last thing im told to do is by overloading the method, make it possible for the user to enter zero(0) and by doing that randomly generate a number before that number goes into the fahrenheit to celsius converting method. Im guessing the generated numbet has to be like between 140-195 because the user needs to enter zero until the generated number equals to 73-77 after converting to celsius!
I know how to generate a random number, and i think i understand what overloading does, but im totally lost on how to do this one...
floatis a better choice thanintordoublefor continuous quantities like temperature. Also, please give us an example of what “to enter zero” means. You know that zero is a perfectly valid temperature, right?