Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Button1_Click(object sender, EventArgs e)
- {
- //Label5.Text = int.Parse(TimeHours.Text);
- try {
- int hour = (int.Parse(TimeHours.Text));
- int min = (int.Parse(TimeMinutes.Text));
- int time = (hour * 60) + min;
- double result = 0;
- double weight = (double.Parse(TextBox1.Text));
- double distance = (double.Parse(TextBox2.Text));
- if (DropDownList1.SelectedIndex == 1) {
- level = 7;
- }
- if (DropDownList1.SelectedIndex == 2) {
- level = 11;
- }
- if (DropDownList1.SelectedIndex == 3) {
- level = 10;
- }
- if (DropDownList1.SelectedIndex == 4) {
- level = ((distance / time) * 0.12) + 2.6;
- } else {
- Label5.Text = "Please select a style of swimming.";
- }
- if (RadioButtonList1.SelectedIndex == 0) {
- result = 1.05 * level * weight * time;
- Label5.Text = "You burned: " + result.ToString() + " calories.";
- } else
- if (RadioButtonList1.SelectedIndex == 1) {
- result = 0.0175 * level * weight * time;
- Label5.Text = "You burned: " + result.ToString() + " calories.";
- } else {
- Label5.Text = "Please check your entries.";
- }
- } catch (FormatException) {
- Label5.Text = "Please check your entries.";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement