static void Main(string[] args) { BMICalculatorClient host = new BMICalculatorClient(); Console.WriteLine("Insert you height (meters): "); var height = Console.ReadLine(); Console.WriteLine("Insert your weight: "); var weight = Console.ReadLine(); Console.WriteLine(host.CalculateBMI(float.Parse(weight), float.Parse(height))); Console.ReadLine(); }
static void Main(string[] args) { var host = new BMICalculatorClient(); Console.Write("Var vänlig och skriv in din vikt: "); var weight = Console.ReadLine().Replace(".",","); Console.Write("Var vänlig och skriv in din längd i meter: "); var heightInMeters = Console.ReadLine().Replace(".",","); var x = 0.0; var doubleHeight = double.TryParse(heightInMeters, out x) ? double.Parse(heightInMeters) : 0.0; var doubleWeight = double.TryParse(weight, out x) ? double.Parse(weight) : 0.0; Console.WriteLine($"Din BMI är: {host.CalculateMyBMI(doubleHeight, doubleWeight).ToString()}"); Console.ReadKey(); }
static void Main(string[] args) { var host = new BMICalculatorClient(); Console.Write("Var vänlig och skriv in din vikt: "); var weight = Console.ReadLine().Replace(".", ","); Console.Write("Var vänlig och skriv in din längd i meter: "); var heightInMeters = Console.ReadLine().Replace(".", ","); var x = 0.0; var doubleHeight = double.TryParse(heightInMeters, out x) ? double.Parse(heightInMeters) : 0.0; var doubleWeight = double.TryParse(weight, out x) ? double.Parse(weight) : 0.0; Console.WriteLine($"Din BMI är: {host.CalculateMyBMI(doubleHeight, doubleWeight).ToString()}"); Console.ReadKey(); }
private void buttonCalc_Click(object sender, EventArgs e) { BMICalculatorClient host = new BMICalculatorClient(); labelResult.Text += host.CalculateBMI(float.Parse(textBoxWeight.Text), float.Parse(textBoxHeight.Text)); }