C-Sharp-Moment
This commit is contained in:
37
lab5_2/lab5_3_CalebFontenot/Form1.cs
Executable file
37
lab5_2/lab5_3_CalebFontenot/Form1.cs
Executable file
@@ -0,0 +1,37 @@
|
||||
namespace lab5_3_CalebFontenot
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void displayButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Define variables
|
||||
const int START_SPEED = 60;
|
||||
const int END_SPEED = 130;
|
||||
const int INTERVAL = 10;
|
||||
const double CONVERSION_FACTOR = 0.6214;
|
||||
|
||||
int kph;
|
||||
double mph;
|
||||
|
||||
// Display the table of speeds.
|
||||
for (kph = START_SPEED; kph <= END_SPEED; kph += INTERVAL)
|
||||
{
|
||||
// Calculate miles per hour.
|
||||
mph = kph * CONVERSION_FACTOR;
|
||||
|
||||
// Display the conversion
|
||||
outputListBox.Items.Add(kph + " KPH is the same as " + mph + " MPH");
|
||||
}
|
||||
}
|
||||
|
||||
private void exitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user