Question: Create a PHP script that will calculate a person's Blood Alcohol Content (BAC). This program will ask the user for the following variables: $weight $gender
Create a PHP script that will calculate a person's Blood Alcohol Content (BAC). This program will ask the user for the following variables:
$weight
$gender ... if male, then $ratio = 0.73; if female, then $ratio = 0.66
$number_of_drinks
$amount_of_alcohol (in ounces) of the drinks consumed (for example, American Beer typically has between 4-6% Alcohol content)
$hours since your last drink
The formula to calculate the Blood Alcohol Content (BAC) is as follows: $BAC = ($amount_of_alcohol * 5.14 / $weight * $ratio) - .015 * $hours Compare the final result to 0.08 (the legal BAC limit) ... if the number is greater than 0.08, display a message saying that the person cannot drive, as they are above the legal limit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
