finished BMI calculator
This commit is contained in:
parent
4a3f344b41
commit
8a2af10422
Binary file not shown.
BIN
20240327/WindowsFormsApp1/.vs/WindowsFormsApp1/v17/.suo
Normal file
BIN
20240327/WindowsFormsApp1/.vs/WindowsFormsApp1/v17/.suo
Normal file
Binary file not shown.
|
@ -25,28 +25,40 @@ namespace WindowsFormsApp1
|
||||||
private void radioButton1_CheckedChanged(object sender, EventArgs e)
|
private void radioButton1_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MaleCheck();
|
MaleCheck();
|
||||||
|
Category();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void radioButton2_CheckedChanged(object sender, EventArgs e)
|
private void radioButton2_CheckedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MaleCheck();
|
MaleCheck();
|
||||||
|
Category();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Data.kg = Convert.ToDouble(textBox1.Text);
|
bool noletters = textBox1.Text.Any(x => !char.IsLetter(x));
|
||||||
UpdateIndex();
|
if (textBox1.Text != "" && noletters)
|
||||||
|
{
|
||||||
|
Data.kg = Convert.ToDouble(textBox1.Text);
|
||||||
|
UpdateIndex();
|
||||||
|
Category();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textBox2_TextChanged(object sender, EventArgs e)
|
private void textBox2_TextChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Data.m = Convert.ToDouble(textBox2.Text)/100;
|
bool noletters = textBox2.Text.Any(x => !char.IsLetter(x));
|
||||||
UpdateIndex();
|
if (textBox2.Text != "" && noletters)
|
||||||
|
{
|
||||||
|
Data.m = Convert.ToDouble(textBox2.Text) / 100;
|
||||||
|
UpdateIndex();
|
||||||
|
Category();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateIndex()
|
public void UpdateIndex()
|
||||||
{
|
{
|
||||||
if (Data.index != null && Data.m != null)
|
if (Data.index != null && Data.m != null && Data.m != 0)
|
||||||
{
|
{
|
||||||
Data.index = Data.kg / (Data.m * Data.m);
|
Data.index = Data.kg / (Data.m * Data.m);
|
||||||
}
|
}
|
||||||
|
@ -84,16 +96,16 @@ namespace WindowsFormsApp1
|
||||||
case double n when n < 19.1:
|
case double n when n < 19.1:
|
||||||
label3.Text = $"BMI:{n}\nSovány";
|
label3.Text = $"BMI:{n}\nSovány";
|
||||||
break;
|
break;
|
||||||
case double n when n >= 20.7 && n < 27.8:
|
case double n when n >= 19.1 && n < 27.3:
|
||||||
label3.Text = $"BMI:{n}\nNormális";
|
label3.Text = $"BMI:{n}\nNormális";
|
||||||
break;
|
break;
|
||||||
case double n when n >= 27.8 && n < 32.3:
|
case double n when n >= 27.3 && n < 31.1:
|
||||||
label3.Text = $"BMI:{n}\nTúlsúlyos";
|
label3.Text = $"BMI:{n}\nTúlsúlyos";
|
||||||
break;
|
break;
|
||||||
case double n when n >= 32.3 && n < 45.4:
|
case double n when n >= 31.1 && n < 44.8:
|
||||||
label3.Text = $"BMI:{n}\nKomolyan Túlsúlyos";
|
label3.Text = $"BMI:{n}\nKomolyan Túlsúlyos";
|
||||||
break;
|
break;
|
||||||
case double n when n >= 45.4:
|
case double n when n >= 44.8:
|
||||||
label3.Text = $"BMI:{n}\nVeszélyeztetett";
|
label3.Text = $"BMI:{n}\nVeszélyeztetett";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1 +1 @@
|
||||||
8069502011d0681850e57a53d5a1673222f430a6
|
ffeb981a72357c13c78580d1de8dfcfdeab69b3831ebd504970e578b1a834c6f
|
||||||
|
|
|
@ -8,3 +8,13 @@ C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\Win
|
||||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
|
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
|
||||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
|
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
|
||||||
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb
|
C:\Users\szabomarton\Desktop\C#\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe.config
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.exe
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\bin\Debug\WindowsFormsApp1.pdb
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.AssemblyReference.cache
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Form1.resources
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.Properties.Resources.resources
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.GenerateResource.cache
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.csproj.CoreCompileInputs.cache
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.exe
|
||||||
|
E:\Házi\Programozás\C#\Suli\ProgaOra\20240327\WindowsFormsApp1\obj\Debug\WindowsFormsApp1.pdb
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user