Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project One, Blood Alcohol Content [C++] Blood alcohol content (BAC) is a measure of how much alcohol is in someones blood. It is usually measured

Project One, Blood Alcohol Content [C++]

Blood alcohol content (BAC) is a measure of how much alcohol is in someones 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%.

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 individuals BAC. This formula is widely used by forensic scientists.

B = -0.015*t+ 2.84*NW*gimage text in transcribed

The variables in the formula are defined as:

B = percentage of 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

Write a C++ computer program that prompts your user for the elements needed to estimate Blood Alcohol Content using the Widmark formula above.

The program should allow your user to continue to make Blood Alcohol Content estimates until they enter a sentinel value. Be sure to inform your user what that sentinel value is. Validate all the user input values. Use the following table to determine which of the possible effects corresponds to the BAC value that was calculated.

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 program should display the BAC value and the possible effects that correspond to that value.

The legal limit for driving is a BAC of 0.08%. If the BAC value is 0.08% or greater, your program should 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, XYProjectOne, 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.

image text in transcribed

Grading Guideline:

  • Create a comment containing the students 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)
  • Define and use a sentinel value correctly. (5 points)
  • Correctly echo back all the input parameters. (10 points)
  • Validate all the user input values. (5 points)
  • Calculate the BAC value correctly. (10 points)
  • Display the BAC value. (5 points)
  • Determine and display the appropriate possible effects. (10 points)
  • Allow 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)
Gender Female Blood Alcohol Content Estimate using Widmark Equation Gender Weight in Number of Hours since Blood Alcohol constant pounds Standard Drinks first drink Content 0.044 0.55 140 0.081 0.118 0.063 0.68 180 0.086 0.109 Male

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

Students also viewed these Databases questions

Question

1. In what ways has flexible working revolutionised employment?

Answered: 1 week ago