?

Log in

No account? Create an account

Previous Entry | Next Entry

Show-IdealWeight.ps1

# Body Mass Index and Ideal Weight Calculator
 
param (
  [float]$weight = (read-host -prompt "Enter weight in pounds"),
  [float]$height = (read-host -prompt "Enter height in inches")
)
 
$idealBmi = ((18.5 + 24.9) / 2) # midpoint of normal range 
$currentBmi = ($weight / ($height * $height)) * 703
$idealWeight = (($idealBmi / 703) * ($height * $height))
 
$bmiPrime = $currentBmi / 25
 
"`nBody Mass Index and Ideal Weight Calculator
 
Body Mass Index
`tCurrent BMI: $currentBmi
`tBMI Prime Ratio: $bmiPrime
`tIdeal BMI: $idealBmi
`tDifference: $($currentBmi - $idealBmi)
 
Weight
`tCurrent Weight: $weight
`tIdeal Weight: $idealWeight
`tDifference: $($weight - $idealWeight)`n"