Created
December 15, 2015 03:07
-
-
Save anonymous/9284017644567c29c7f8 to your computer and use it in GitHub Desktop.
This file contains 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
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(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(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("Pounds:") | |
print(bmi.pounds(150, height: 65)) | |
print("Kilograms:") | |
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