Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1.  
  2. // Classe Conversor - Incompleta
  3.  
  4. public class Conversor{
  5.  
  6.     public double CelsiusToKelvin(double celsius)
  7.     {
  8.         double kelvin = celsius + 273.15;
  9.  
  10.         return kelvin;
  11.     }  
  12. }
  13.  
  14.  
  15. // No botão Calcular, se a opção escolhida for de Celsius Para Kelvin
  16.  
  17. double valor = Convert.ToDouble(txt_valor.Text);
  18.  
  19. Conversor objConversor = new Conversor();
  20.  
  21. double kelvin = objConversor.CelsiusToKelvin(valor);
  22.  
  23. txt_resultado.Text = Convert.ToString(kelvin);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement