o learn to code compile and run a program containing repetition structures

Assignment

Plan and code a program utilizing one or more repetition structures to solve the following problem:

After caffeine is absorbed into the body, 13% is eliminated from the body each hour. Assume a person drinks a

cup of coffee or caffeinated beverage and that the caffeine is absorbed immediately into the body. Write a

program to calculate the following values:

The amount of caffeine in the body X hours after the person drinks the coffee.

Input

The type of drink, the amount of caffeine and how many hours they want to see the output for.

Test data:

16 oz Starbucks coffee 310 mg of caffeine

Show 10 hours

5-hr Energy drink

245 mg

Show 7 hours

Black tea

47 mg

Show 5 hours

Red Bull

80 mg

Show 12 hours

Output

A listing of caffeine remaining after each hour until the user’s limit is reached. Remember to set the precision to

something reasonable.

Note

Adequately check entered data for validity. Use adequate test data to process all valid data and representative

data to show how your program handles invalid data. Caffeine must not be greater than 350, hours must be a

positive number not greater than 14.

Label all output clearly. Be sure your output file contains user prompts and what was entered by the user in

addition to the results of your program processing.

BE SURE TO INCLUDE ADEQUATE ERROR HANDLING IN YOUR PROGRAM AND ERROR DATA WHEN YOU RUN THE

PROGRAM TO DEMONSTRATE ERROR HANDLING.

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.



Buy Custom Nursing Papers

 

"Is this question part of your assignment? We Can Help!"

Essay Writing Service