-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
78 lines (66 loc) · 1.94 KB
/
Copy pathProgram.cs
File metadata and controls
78 lines (66 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Windows.Forms;
namespace BMI_Calculator
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new IntroForm());
}
//BELOW IS BASE CODE TO PROVIDE FUNCTIONALITY
//Different classes called if user chooses imperial or metric
public static double imperial(double height, double weight)
{
//instantiate new class
Imperial imp = new Imperial(height, weight);
//round number to one decimal place
double bmi = Math.Round(imp.Calc(), 1);
return bmi;
}
public static double metric(double height, double weight)
{
//instantiate new class
Metric imp = new Metric(height, weight);
//round number to one decimal place
double bmi = Math.Round(imp.Calc(), 1);
return bmi;
}
//function to categorize BMI
public static string BmiCategory(double BMI)
{
string status;
if (BMI < 18.5)
{
status = "Underweight";
return status;
}
else if (BMI > 18.4 && BMI < 25.0)
{
status = "Healthy Weight";
return status;
}
else if (BMI > 24.9 && BMI < 30.0)
{
status = "Overweight";
return status;
}
else if (BMI > 29.9)
{
status = "Obese";
return status;
}
else
{
status = "Error: Unable to categorize";
return status;
}
}
}
}