37 lines
1013 B
C#
Executable File
37 lines
1013 B
C#
Executable File
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();
|
|
}
|
|
}
|
|
} |