Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Number of Drinks Write a program that estimates the number of alcoholic drinks (12 ounce beer, 5 ounce wine, or 1.5 ounces of distilled spirits)

image text in transcribed
image text in transcribed
Number of Drinks Write a program that estimates the number of alcoholic drinks (12 ounce beer, 5 ounce wine, or 1.5 ounces of distilled spirits) you can consume and remain within the legal limit of 0.08 per cent of Blood Alcohol Content (BAC). Your program will prompt the user to enter their weight in pounds and the percentage of alcohol in the beer they are drinking. Ordinary beers contain between 4% and 5% alcohol. (Represent percentage values such as 4% as 0.04, and 5% as 0.05.) Your program will use a function named numbrinks () that receives two arguments: - the user's weight (pounds) - the percentage of alcohol in the beer It will return an estimate of the number of drinks the user can have while remainifg g under the legal limit of Blood Alcohol Content. The formula you will use is a simplified version of the formula developed by Swedish physician E. M. P. Widmark. drinks=(0.08+0.015)weight/(127.5alcohol): Where: drinks = Estimate of the number of drinks. weight = Weight in pounds. alcohol = Percentage of alcohol in the beer. The program you write will repeatedly prompt the user to enter their weight and the percentage of alcohol in the beer. Use a while input validation loop to ensure that the value entered for weight is a positive number. Think about what controls your program should place on the values of alcohol percentage to make your program useful. A sentinel value of your choosing will terminate the 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

More Books

Students also viewed these Databases questions

Question

7. Explain why retirees may be valuable as part-time employees.

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago