Question: Time to upgrade your Basic Menu program to something useful: a caffeine intake tracker. A cup of coffee has 92mg of caffeine, while a cup
Time to upgrade your Basic Menu program to something useful:
a caffeine intake tracker. A cup of coffee has 92mg of caffeine, while a cup of tea has 26 mg.
Write a program which allows the user to enter a choice of tea/coffee/water. With each choice the caffeine value should be updated. If the user consumes more than 300mg of caffeine, print a warning. The program should run for as long as the user wants.
Example program run (note that the total amount of caffeine consumed is printed in the end):
enter 0 for Tea, 1 for Coffee, 2 for Water, 3 to Quit the Program choice: 0 You chose Tea: +26mg caffeine choice: 1 You chose Coffee: +92mg caffeine choice: 2 You chose Water: no caffeine choice: 2 You chose Water: no caffeine choice: 1 You chose Coffee: +92mg caffeine choice: 2 You chose Water: no caffeine choice: 2 You chose Water: no caffeine choice: 1 You chose Coffee: +92mg caffeine You had enough coffee for the day! choice: 1 You chose Coffee: +92mg caffeine You had enough coffee for the day! choice: 3 You had 394 mg's of caffeine today You had enough coffee for the day!
PreviousNext
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
