Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2) Write a function that calculates and returns the level of alcohol concentration in the blood for a person who has been drinking (BAC). There

image text in transcribed

2) Write a function that calculates and returns the level of alcohol concentration in the blood for a person who has been drinking (BAC). There are several ways to calculate this value, but in this exercise the following formula will be used: BAC= 0.0 15. t+ 0.0165 where: A-alcohol consumed (in grams) w = body mass (in hect grams) ttime since the first drink (in hours) r-constant that represents the fraction of the body mass in which alcohol could be present: 0.68 for men, 0.55 for women Note that the variable r is different for men and for women, so you need an if that asks if the sex of the person is 'F' (female) or 'N' (male) to assign the value to the variable r that will be lused in the formula: 0.55 or 0.68, respectively This function has the purpose of calculating the BAC only, so the values of A, w, t and the sex of the person who has been drinking (F' or 'N') need to be provided. The variable sex is char Note: Only the function that does what is described here is requested, not the complete program

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions