Answer to Question #42844 in Other Programming & Computer Science for Paul

Question #42844
Allow the user to enter a series of temperatures in degrees Celsius ( C) terminated by the input of – 999. For each one, find the corresponding temperature in degrees Fahrenheit ( F). The conversion formula is: F = 9 * C/ 5 + 32.
Expert's answer
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;

namespaceConsoleApplication14
{
class Temp
{
public double Fahrenheit(doubleC)
{
doubleF;
F = (9 * C / 5) + 32;
Console.WriteLine("Corresponding temperature in degrees Fahrenheit :"+Math.Round(F,2));
return F;
}

}

class Program
{
static void Main()
{
ConsoleKeyInfok;
do
{
Tempd = new Temp();
doubleC;
Console.Write("enter a temperature in degrees Celsius ");
C = double.Parse(Console.ReadLine());
if(C < -999)
{
Console.Write("Please,enter a temperature in degrees Celsius more then -999 : ");
C = double.Parse(Console.ReadLine());
d.Fahrenheit(C);
}
elsed.Fahrenheit(C);
Console.WriteLine("...Press ESC to exit...");
k = Console.ReadKey(true);
Console.Clear();
}
while(k.Key != ConsoleKey.Escape);


Console.ReadLine();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal