Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions