Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSSTEst
- {
- public partial class Index : System.Web.UI.Page
- {
- double level = 0;
- int time = 0;
- double distance = 0;
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) {
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- //Label5.Text = int.Parse(TimeHours.Text);
- 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.";
- }
- }
- protected void Button2_Click(object sender, EventArgs e)
- {
- Button2.Attributes.Add("onClick", "document.forms[0].reset();return false;");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement