I got this homework

1. Write a function that serves to determine the police action to which it is exposed a driver who is guiding under the influence of alcohol.

The function receives the % concentration of alcohol in a persons blood you have (BAC) and print one of the following signs depending on the range. Where blood alcohol levels (BAC) are found:

Levels of concentration

0.01 % <=BAC < 0.05% The driver unlikely to be within the ilegal.
0.05% <= BAC < 0.10% The driver may be subject to arrest.
.10% <= BAC the driver would have an automatic arrest.

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 = A/r* - 0.015*t + 0.0165

where A is the alcohol consumed, w is the mass, t time elapsed from the first drink (in hours) r constant represent the fraction of the body mass in which alcohol could be present 0.68 for men, 0.55 for women. Note that R is different for men and women, so you need an IF. to ask if the persons sex is 'F' (feminine) or 'M' (masculine) for. Assign the value to the variable R to be used in the formula: 0.55 0r 0.68 respectively.
This function is intended to calculate the BAC only, si you need to be provided (you get) the values of a, W, T and the sex of the person who has been drinking ('F' or 'M') The sex variable is CHAR.
3. Develop a function that asks the user for the following information about a person who has a been consuming alcohol:
a. enter the weight of the person in pounds (must be greater than 0.0 b. number of drinks consumed (nb)(must not be negative) c.alcohol content of a beverage in grams (ca) must not be negative. d. time in hours it took to consume beverages (t) should not be negative . e. sex of the person only 'F' or 'M' as valid characters. Validate input data by using a cyclic statement.

4. Function that calculates and return the amount of alcohol consumed by a person(A) based on the number of drinks consumed (nb) and the alcohol content of a drink in grams (ca). A = nb*ca
5 Function that calculates and return the body mass of a person (w) based on their weight in pounds. The formula for converting pounds to body mass in hectograms is. w = 10 divide by 2.2046 * pounds.
6. Function that prints a sign on screen that says: "Program to determine risks in case of driving after having consumed alcohol".

the output
Program to determine risks in case of driving after having consumed alcohol".

enter the weight in pounds of the driver:
Alcohol content of a beverage in grams:
Among the number of drinks consumed:
Between the time in hours it told to consume the drinks:
Between the sex of the person (F = Feminine, M = Male):


Percentage of blood alcohol concentration:

Possible police action corresponding to your alcohol levels:
===> It could be subject to arrest at the discretion of the officer

Is there anything you needed help with specifically regarding this assignment? Generally speaking, most people on this forum are here to help with a few problems but not do an entire an homework assignment for you.

You should at least make an effort in trying to solve the problem at task and if you need help then ask for help but don't expect people to do everything for you.
Im almost done I having problem with 2 and 4. I just put the whole assignment to let people know not to do the whole thing
Registered users can post here. Sign in or register to post.