Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project One, Blood Alcohol Content Display the BAC value to three decimal places and the possible effects that correspond to that value. Blood alcohol content
Project One, Blood Alcohol Content Display the BAC value to three decimal places and the possible effects that correspond to that value. Blood alcohol content (BAC) is a measure of how much alcohol is in someone's blood. It is usually measured as a percentage, so a BAC of 0.3% is three-tenths of one percent. That is, there are 3 grams of alcohol for every 1,000 grams of blood. A BAC of 0.05% impairs reasoning and the ability to concentrate. A BAC of 0.30% can lead to a blackout, shortness of breath, and loss of bladder control. In most states, the legal limit for driving is a BAC of 0.08%. The minimum value for the number of standard drinks is one (1). Write your program to validate user input and allow real values such as 1.5 for the number of drinks. Weight must be greater than zero (0) and real values such as 194.7 should be permitted. The number of hours since the first drink must be greater than zero (0) and real values such as 2.5 should be permitted. BAC is usually measured by a breathalyzer, urinalysis, or blood test. However, Swedish physician E. M. P. Widmark developed the following equation for estimating an individual's BAC. This formula is widely used by forensic scientists. (2.84 * N B = -0.015+t+ W+ ) The legal limit for driving is a BAC of 0.08%. If the BAC value is 0.08% or greater, also display a phrase like "Over the legal limit for driving." To receive full credit for this programming assignment, you must: Use the correct file name, "XY Projectone", where "X" and "Y" are your first and last initials. Submit a program that executes correctly. Interact effectively with the user in your prompts and error messages. The variables in the formula are defined as: B = percentage of Blood Alcohol Content (BAC) N = number of "standard drinks" (N should be at least 1) (NOTE: A standard drink is one 12-ounce beer, one 5- ounce glass of wine, or one 1.5-ounce shot of distilled liquor.) W = weight in pounds g = gender constant, 0.68 for men and 0.55 for women t = number of hours since the first drink Grading Guideline: Create a comment containing the student's full name. (5 points) Document the program with other meaningful comments. (5 points) Prompt the user for the number of standard drinks. (5 points) Prompt the user for their weight in pounds. (5 points) Prompt the user for their gender. (10 points) Use the correct gender constant. (5 points) Prompt the user for the number of hours since the first drink. (5 points) Correctly echo back all the input parameters. (10 points) Validate all the user input values. (10 points) Calculate the BAC value correctly. (10 points) Display the BAC value to 3 decimal places. (5 points) Determine and display the appropriate possible effects. (10 points) Allow the user to repeatedly make BAC estimates. (5 points) Correctly add "Over the limit" when BAC is 0.08% or greater. (5 points) Use prompts and error messages that were easy to understand. (5 points) BAC Estimate Possible Effects Less Than 0.03% Normal behavior, no impairment 0.03% or greater, but less than 0.06% Mild euphoria and impairment 0.06% or greater, but less than 0.10% Euphoric, increased impairment 0.10% or greater, but less than 0.20% Drunk, loss of motor control 0.20% or greater, but less than 0.30% Confused, possible blackout | 0.30% or greater, but less than 0.40% | Possibly unconscious 0.40% or greater Unconscious, risk of death Your Instructor will run the program you submit to test and grade it. Be sure to test it yourself and verify that it produces correct output before submitting your work. Use different sets of input values and verify each set with hand calculations. Write a Java Application program that prompts your user for the information needed to estimate Blood Alcohol Content using the Widmark formula above. The program will allow your user to repeatedly make Blood Alcohol Content estimates. Validate all the user input values. Use the table above to determine which of the possible effects corresponds to the BAC value that was calculated
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started