Click here to Skip to main content
Click here to Skip to main content
Go to top

BAC Calc

, 29 Nov 2004
Rate this:
Please Sign up or sign in to vote.
Blood-alcohol level calculator.

Sample Image

Introduction

A handy-dandy blood-alcohol calculator. Obviously, this isn't to be used as an accurate measuring device, just rough estimate.

Background

Found a picture here that had a BAC formula, so I coded it for weekend use.

Using the code

Change the values as needed, your estimated BAC will update automagically. Here's the formula, for the curious.

(Number of drinks / 2) * (9 / Weight for Men  OR 7.5 / 
             Weight for Women) - (.016 * Hours Drinking) = BAC

Points of Interest

Setting all controls on the forms' 'value changed' (or equivalent) to the same 'calc()' function made for little code.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Adam McKee
Software Developer (Senior)
United States United States
No Biography provided

Comments and Discussions

 
QuestionCode Comments? Pinmemberkusokurae2-Dec-04 15:41 
Questionam i drunk or not? Pinmemberdiesel_travis30-Nov-04 10:09 
AnswerRe: am i drunk or not? Pinmemberstrtdusty30-Nov-04 12:08 
GeneralRe: am i drunk or not? Pinsussleewsimpson1-Dec-04 7:06 
GeneralRe: am i drunk or not? Pinsussleewsimpson1-Dec-04 7:06 
Answer...I just added extra labels to my version... Pinmemberdiesel_travis1-Dec-04 11:17 
// NYS legal limits
// http://www.nydmv.state.ny.us/broch/c39.htm
if (temp >= 0.08)
{
     // DWI
     lblNYS.Text = "NYS: DWI";
}
else
{
     if (temp >= 0.05)
     {
          // DWAI
          lblNYS.Text = "NYS: DWAI";
     }
     else
     {
          lblNYS.Text = "NYS: OK!";
     }
 
     // Under 21
     if (temp >= 0.02)
     {
          // Zero tolerance
          lblNYS.Text += "; < 21 Zero Tolerance";
     }
}
// additional CDL limits
if (temp >= 0.07)
{
     // Per Se Level II
     lblNYS.Text += "; CDL: P.S.L. II";
}
else if (temp >= 0.04)
{
     // Per Se Level I
     lblNYS.Text += "; CDL: P.S.L. I";
}
 
// Physical Reactions
// http://www.nvo.com/beaulier/theeffectsofalcohol/
// http://www.ou.edu/oupd/bac.htm
if (temp >= 4)
{
     // YOU ARE DEAD.
     lblDrunk.Text = "Death X-(";
}
else if (temp >= 0.40)
{
     // Onset of coma, and possible death due to respiratory arrest.
     lblDrunk.Text = "Coma |-{";
}
else if (temp >= 0.35)
{
     // Coma is possible. This is the level of surgical anesthesia.
     // You fall unconsciousness and begin to have breathing difficulties. You are at serious of suffering   brain damage or dying.
     lblDrunk.Text = "Possible Coma |-(";
}
else if (temp >= 0.30)
{
     // STUPOR. You have little comprehension of where you are. You may pass out suddenly and be difficult to awaken.
     // You are at dangerous levels of intoxication. You are in a black out and are not in control of your behaviors.
     lblDrunk.Text = "Stupor ;-/";
}
else if (temp >= 0.25)
{
     // All mental, physical and sensory functions are severely impaired. Increased risk of asphyxiation from choking on vomit and of seriously injuring yourself by falls or other accidents.
     lblDrunk.Text = "Severely Drunk ;-O";
}
else if (temp >= 0.20)
{
     // Feeling dazed/confused or otherwise disoriented. May need help to stand/walk. If you injure yourself you may not feel the pain. Some people have nausea and vomiting at this level. The gag reflex is impaired and you can choke if you do vomit. Blackouts are likely at this level so you may not remember what has happened.
     // You are extremely intoxicated and probably cannot spell car let alone drive one. You may experience problems speaking and have a serious loss of balance.
     lblDrunk.Text = "Confused Drunk ;-?";
}
else if (temp >= 0.16)
{
     // Dysphoria predominates, nausea may appear. The drinker has the appearance of a "sloppy drunk."
     lblDrunk.Text = "Sloppy Drunk ;-|";
}
else if (temp >= 0.15)
{
     // At this stage you are very drunk. Memory loss may occur. You may feel nausea and sleepy. You are unable to perform simple tasks and may slur your words
     lblDrunk.Text = "Very Drunk :-P";
}
else if (temp >= 0.13)
{
     // Gross motor impairment and lack of physical control. Blurred vision and major loss of balance. Euphoria is reduced and dysphoria* is beginning to appear. Judgment and perception are severely impaired. (* —Dysphoria: An emotional state of anxiety, depression, or unease.)
     lblDrunk.Text = "Blurry Drunk :-}";
}
else if (temp >= 0.10)
{
     // Muscle control and balance is greatly reduced.   You may react to outside stimulus emotionally.
     lblDrunk.Text = "Drunk Big Grin | :-D ";
}
else if (temp >= 0.08)
{
     // Reaction time is greatly reduced and memory is weakened.
     lblDrunk.Text = "Legally Drunk Smile | :) ";
}
else if (temp >= 0.05)
{
     // Inhibitions start to disappear and you "loosen up."
     lblDrunk.Text = "Nealy Drunk Smile | :) ";
}
else if (temp >= 0.02)
{
     // Reaction time and ability to perform complex tasks is reduced.
     lblDrunk.Text = "Almost Drunk Smile | :) ";
}
else
{
     // Sober
     lblDrunk.Text = "Not Drunk :-/";
}
GeneralRe: ...I just added extra labels to my version... Pinmemberdiesel_travis1-Dec-04 11:20 
GeneralRe: ...I just added extra labels to my version... Pinmemberkusokurae2-Dec-04 14:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 30 Nov 2004
Article Copyright 2004 by Adam McKee
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid