A person would like to know how to determine his/her blood alcohol content (BAC). In Colorado, the legal driving limit is 0.08.
Blood alcohol content (BAC) is usually expressed as a percentage of ethanol in the blood in units of mass of alcohol per volume of blood or mass of alcohol per mass of blood. So, for example, in North America a BAC of 0.1 (0.1% or one tenth of one percent) means that there are 0.10 g of alcohol for every dL (deciliter) of blood.
A standard American drink contains 0.5 US fl oz (15 ml) of alcohol by volume, and is equivalent to:
12 oz of beer (5% alcohol)
5 oz of wine (12% alcohol)
1.5 oz shot of 80 proof liquor (40% alcohol)
This means that there are 14 grams of alcohol in one standard American drink.
Back in 1932, Swedish scientist Eric Widmark established the following formula for determining a persons initial BAC is:
BAC = (Alcohol consumed (in grams) / weight (in grams) x volume distribution (by gender)) x 100
In the original formulas, the volume distributions of alcohol in the blood by gender were fixed values. One value (0.68) was used for males, and another value (0.55) was used for females.
However, in 1986, English chemist Robert Forrest came up with a better way to calculate the volume distribution (by gender), taking the persons weight and height into account.
Male Volume Distribution = 1.0178 - ((0.012127 x weight) / height2)
Female Volume Distribution = 0.8736 - ((0.0124 x weight) / height2)
where weight is in kilograms and height is in meters
Using the above formulas allow a person to calculate their BAC immediately after drinking. The volume distribution is calculated first, and then the volume distribution is used in the Widmark formula.
However, most of the time, people consume drinks over a period of time. So the current BAC is further calculated by:
current BAC = BAC - (elapsed time in hours x metabolic rate)
The metabolic rate, characterizes the speed of alcohol absorption and elimination. Females demonstrated a higher average rate of elimination (mean, 0.017; range, 0.014 to 0.021) than males (mean, 0.015; range, 0.013 to 0.017). Due to these factors, and other differences between people, the BAC calculated in this program is only an ESTIMATE.
For this program, we will use the low end of the ranges.
In your last two Alice assignments, you:
This assignment will require you to do the same things in Java.
This program will contain:
1. Create only one Java class for this program, named as follows:
LastnameJavaClassName
For example: SmithBACcalculator
2. The methods described above will be implemented within this class, as follows:
NOTE: All of these methods should have descriptive names that include a verb, describing the methods action.
Method 1: A method to display an explanation of what the program will do to the user.
Methods 2 & 3: Two methods to calculate the volume distribution of alcohol, one method for men and one method for women. These methods will:
Method 4: A method to calculate the current BAC. This method will:
Method 5: A method to display the results, with no return value. This method will:
3. Within the main method, write the Java code to:
NOTE: The main method will be defined first, at the top of the class, before all the other methods.
This program implements a Blood Alcohol Content (BAC) Calculator
Given a drinker's weight and height, and the number of drinks consumed over how many hours, it will compute the person’s approximate current blood alcohol content.>
Please enter drinker's height (in inches): 66
Please enter the drinker's weight (in pounds): 150
How many drinks were consumed? 4
How many whole hours have elapsed since drinking began? 2
After drinking 4 drinks, in 2 hours:
Current BAC for a male will be approximately 0.084
Current BAC for a female will be approximately 0.116
4. You must also define and use: