TipTaxTotal, DistanceTraveled, CtoFandFtoC
This commit is contained in:
59
MP1/CelsiusAndFahrenheitTemperatureConverter_CalebFontenot/Form1.cs
Executable file
59
MP1/CelsiusAndFahrenheitTemperatureConverter_CalebFontenot/Form1.cs
Executable file
@@ -0,0 +1,59 @@
|
||||
namespace CelsiusAndFahrenheitTemperatureConverter_CalebFontenot
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buttonConvertCelsius_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Define Vars
|
||||
double celsius;
|
||||
double fahrenheit;
|
||||
|
||||
// Get Data
|
||||
//celsius = double.Parse(celsiusTextBox.Text);
|
||||
fahrenheit = double.Parse(fahrenheitTextBox.Text);
|
||||
|
||||
// Calculate!
|
||||
celsius = 5 / 9.0 * (fahrenheit - 32);
|
||||
|
||||
// Print output
|
||||
celsiusTextBox.Text = celsius.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Invalid input!");
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonConvertFahrenheit_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Define Vars
|
||||
double celsius;
|
||||
double fahrenheit;
|
||||
|
||||
// Get Data
|
||||
celsius = double.Parse(celsiusTextBox.Text);
|
||||
//fahrenheit = double.Parse(fahrenheitTextBox.Text);
|
||||
|
||||
// Calculate!
|
||||
fahrenheit = 9 / 5.0 * celsius + 32;
|
||||
|
||||
// Print output
|
||||
fahrenheitTextBox.Text = fahrenheit.ToString();
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Invalid input!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user