TipTaxTotal, DistanceTraveled, CtoFandFtoC

This commit is contained in:
2022-09-06 14:32:37 -05:00
parent 5576351339
commit bb25fe9ac8
93 changed files with 1200 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
namespace DistanceTraveled_CalebFontenot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void calculateButton_Click(object sender, EventArgs e)
{
try
{
// Define Vars
double MPH;
double distance5h;
double distance8h;
double distance12h;
// Get data
MPH = double.Parse(mphBox.Text);
// Calculate!
distance5h = MPH * 5; // 5 hours
distance8h = MPH * 8; // 8 hours
distance12h = MPH * 12; // 12 hours
// Print output
label5hr.Text = "The object will have traveled " + distance5h.ToString() + " miles in 5 hours.";
label8hr.Text = "The object will have traveled " + distance8h.ToString() + " miles in 8 hours.";
label12hr.Text = "The object will have traveled " + distance12h.ToString() + " miles in 12 hours.";
}
catch
{
MessageBox.Show("Invalid input!");
}
}
}
}