Created
August 27, 2019 08:56
-
-
Save angelabauer/29870029c5d8adb22e5c3e29b672f1c0 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 | |
struct CalculatorBrain { | |
var bmi: Float = 0.0 | |
func getBMIValue() -> String { | |
let bmiTo1DecimalPlace = String(format: "%.1f", bmi) | |
return bmiTo1DecimalPlace | |
} | |
mutating func calculateBMI(height: Float, weight: Float) { | |
bmi = weight / (height * height) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Okay