Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
Write a Windows application that converts a temperature from Fahrenheit to Centigrade and Kelvin. The program should accept a Fahrenheit temperature and then provide a single Button that will convert this temperature to both Centigrade and Kelvin and place the results in designated Labels formatted so that it shows exactly two decimal places.This is for homework but my teacher has missed 2 online classes and this is due tomorrow,all i need is a little help but i dont know where to begin,please help

C#
decimal F = decimal.Parse(TempUnits.Text);
decimal C = decimal.Parse(Celsius.Text);
decimal K = decimal.Parse(Kelvin.Text);
K = C + 273;
C = (F - 32) * 5 / 9;
F = K - 153;


How do i put it in the label text should i convert it to string?
Posted
Updated 24-Apr-11 15:48pm
v3

This article lists the conversion formulas:

http://www.fordhamprep.org/gcurran/sho/sho/lessons/lesson29.htm[^]

That should help you get started. If you have specific Winforms related questions, then start a separate thread for those.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Apr-11 21:51pm    
Nishant, are you serious? That lesson 29? Did you notice OP cannot do a single linear equation from elementary algebra?
I also deleted re-post done by OP after this answer was received.
Any concrete help seems useless.

Please see my answer -- nothing else can help, honestly. :<
--SA
Nish Nishant 24-Apr-11 21:59pm    
I replied to the first version of his question. After seeing my response he seems to have edited his question and added some code.
Sergey Alexandrovich Kryukov 24-Apr-11 22:01pm    
That explains it. A 5.
(I saw your similar answer before, I think. Again, looks like the same assignment for several students. It looks scary -- who they want to graduate in this manner?)
--SA
Sergey Alexandrovich Kryukov 25-Apr-11 20:51pm    
This is what all this activity comes to:
http://www.codeproject.com/Questions/186731/You-guys-are-supposed-to-help.aspx

Too funny, isn't it?
--SA
Do not use decimal, use double.

Use this: http://en.wikipedia.org/wiki/Kelvin[^], http://en.wikipedia.org/wiki/Farenheit[^]. Use the method double.ToString.

You make elementary mistake in first line (Kelvin from Celsius), and third line (Fahrenheit from Kelvin) even though it is in apparent contradiction of the second line.

It looks like you have problems with most simple task of elementary algebra. Sorry, we cannot provide any help to people who did not master such elementary topics. Please, consider it very seriously: you cannot do any programming — just yet. Back to school!

—SA
 
Share this answer
 
v3
Comments
Venkatesh Mookkan 24-Apr-11 21:48pm    
Good answer!
Sergey Alexandrovich Kryukov 24-Apr-11 21:53pm    
Thank you, Venkatesh. (Wow, you were fast! :-)
--SA
Venkatesh Mookkan 24-Apr-11 21:55pm    
Actually, you are fast! I was about to answer it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900