Last active
December 15, 2015 05:47
-
-
Save HopperMCS/c2166174be878e9cea78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * The second revision to polish up the code a bit more. | |
| * (c) 2015 MGage Morgan | |
| */ | |
| import Foundation | |
| public class bmi { | |
| public static func pounds(weight: Double, height: Double) { | |
| let Height = height * height | |
| let thirds = weight / Height | |
| let result = thirds * 703 | |
| print("BMI In Pounds: ") | |
| print(result) | |
| if (result <= 18.4) { | |
| print("You are underweight.") | |
| } else if (result <= 25.1) { | |
| print("You are normal.") | |
| } else if (result <= 29.9) { | |
| print("You are obeest.") | |
| } else if (result >= 29.9) { | |
| print("You are MORBIDLY OBEEST.") | |
| } else { | |
| print("You've managed to break the machine.") | |
| } | |
| } | |
| public static func kilograms(weight: Double, height: Double) { | |
| let Height = height * height | |
| let result = weight / Height | |
| print("BMI in Kilograms:") | |
| print(result) | |
| if (result <= 18.4) { | |
| print("You are underweight.") | |
| } else if (result <= 25.1) { | |
| print("You are normal.") | |
| } else if (result <= 29.9) { | |
| print("You are obeest.") | |
| } else if (result >= 29.9) { | |
| print("You are MORBIDLY OBEEST.") | |
| } else { | |
| print("You've managed to break the machine.") | |
| } | |
| } | |
| } | |
| print(bmi.pounds(150, height: 65)) | |
| print(bmi.kilograms(68.0, height: 1.65)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment