first commit
This commit is contained in:
36
listas3/source/exercicio6.cs
Normal file
36
listas3/source/exercicio6.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace exercicios
|
||||
{
|
||||
public class Exercicio6
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
string sexo;
|
||||
float i_altura;
|
||||
|
||||
Console.WriteLine("Biological sex (male/female):");
|
||||
sexo = Console.ReadLine();
|
||||
|
||||
Console.WriteLine("Height (in meters):");
|
||||
i_altura = float.Parse(Console.ReadLine());
|
||||
|
||||
Console.WriteLine("\n{0:N2} is the ideal weight for a {1}, with the height of: {2}m",
|
||||
calcularPesoIdeal(i_altura,sexo),sexo,i_altura);
|
||||
}
|
||||
static float calcularPesoIdeal(float i, string s)
|
||||
{
|
||||
switch(s.ToLower())
|
||||
{
|
||||
case "male":
|
||||
return (72.7f*i)-58f;
|
||||
case "female":
|
||||
return (62.1f*i)-44.7f;
|
||||
default:
|
||||
Console.WriteLine("\nWrite a valid value!");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user