case D: defauit valdeeverage = true: break valdBeverage = faise; (valdBeverage true) cout e "How many cups would you ke?" < endit Fill in the code to read in number OF MI IN Fill in the code to begin a switch statement N that is controlled by beverage case 'a: case A: cost = number * 1.0 cout e "The total cost is S< cost end; break: " Fil in the code to give the case for hot chocolate ($1.25 a cup) W Filin the code to give the case for tea ($0.75 a cup) W Filin the code to give the case for cappuccina ($2.50 a cup) case e: case 'E: cout se " Flease come again" e ena break, defauit cout e l Fill in the code to write a message W indicating an invalid selection. cout Try again please" e endl: ) } Fil in the code to finish the do-while statement with the NAD MIN

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter2: Basic Elements Of C++
Section: Chapter Questions
Problem 24SA
icon
Related questions
Question
case D:
defaut:
valoBeverage = true,
break
valdBeverage = faise;
(valdBeverage == true)
UF
cout e "How many cups would you Nke?" << endi;
Fill in the code to read in number
I Fill in the code to begin a switch statement
N that is controlled by beverage
case a: case
A:
cost = number * 1.0
cout <e "The total cost is $<< cost e endl;
break
N Fill in the code to give the case for hot chocolate ($1.25 a cup)
N Fil in the code to give the case for tea ($0.75 a cup)
I Fil in the code to give the case for cappuccino ($2.50 a cup)
case e
cout e * Please come again" <e
end break
case 'E
defaut:
cout e Fil in the code to write a message
W indicating an invalid selection.
cout e Try again please" ee end )
W Fil in the code to finish the do-while statement with the
N condition that beverage does not equal E or e
I Fill in the appropriate return statement
1946
29
1. Fill in the indicated code to complete the above program. Then compile and run
the program several times with various inputs. Try all the possible relevant cases
and record your results. What did you realize from this exercise?
2. What do you think will happen if you do not enter A, B, C, D, or E? Try running
the program and inputting another letter.
NADS
MIN
Transcribed Image Text:case D: defaut: valoBeverage = true, break valdBeverage = faise; (valdBeverage == true) UF cout e "How many cups would you Nke?" << endi; Fill in the code to read in number I Fill in the code to begin a switch statement N that is controlled by beverage case a: case A: cost = number * 1.0 cout <e "The total cost is $<< cost e endl; break N Fill in the code to give the case for hot chocolate ($1.25 a cup) N Fil in the code to give the case for tea ($0.75 a cup) I Fil in the code to give the case for cappuccino ($2.50 a cup) case e cout e * Please come again" <e end break case 'E defaut: cout e Fil in the code to write a message W indicating an invalid selection. cout e Try again please" ee end ) W Fil in the code to finish the do-while statement with the N condition that beverage does not equal E or e I Fill in the appropriate return statement 1946 29 1. Fill in the indicated code to complete the above program. Then compile and run the program several times with various inputs. Try all the possible relevant cases and record your results. What did you realize from this exercise? 2. What do you think will happen if you do not enter A, B, C, D, or E? Try running the program and inputting another letter. NADS MIN
II This program displays a hot beverage menu and prompts the user to
Il make a selection. A switch statement determines
Il which item the user has chosen. A do-while loop repeats until
I/l the user selects item E from the menu.
#include <iostream>
#include <iomanip>
SITY OF
using namespace std;
int main()
I Fill in the code to define an integer variable called
Il number, a floating point variable called cost,
Il and a character variable called beverage
bool validBeverage;
cout <« fixed << showpoint << setprecision(2);
do
cout << endl << endi; cout << "Hot Beverage Menu"
« endi<< endl; cout << "A: Coffee $1.00" <
endi; cout<< "B: Tea S.75"<<endl; cout <« "C: Hot
Chocolate $1.25" «< endl; cout << "D: Cappuccino
$2.50" << endl << endl << endl; cout << "Enter the
beverage A,B,C, or D you desire"
« endi; cout << "Enter E to exit the program"
« endi << endl;
I/ Fill in the code to read in beverage
ITY
switch(beverage)
1946
case 'a
case 'A:
case 'b:
case 'B
case c: case
'C: case d:
AQ-
MINDANAO
Transcribed Image Text:II This program displays a hot beverage menu and prompts the user to Il make a selection. A switch statement determines Il which item the user has chosen. A do-while loop repeats until I/l the user selects item E from the menu. #include <iostream> #include <iomanip> SITY OF using namespace std; int main() I Fill in the code to define an integer variable called Il number, a floating point variable called cost, Il and a character variable called beverage bool validBeverage; cout <« fixed << showpoint << setprecision(2); do cout << endl << endi; cout << "Hot Beverage Menu" « endi<< endl; cout << "A: Coffee $1.00" < endi; cout<< "B: Tea S.75"<<endl; cout <« "C: Hot Chocolate $1.25" «< endl; cout << "D: Cappuccino $2.50" << endl << endl << endl; cout << "Enter the beverage A,B,C, or D you desire" « endi; cout << "Enter E to exit the program" « endi << endl; I/ Fill in the code to read in beverage ITY switch(beverage) 1946 case 'a case 'A: case 'b: case 'B case c: case 'C: case d: AQ- MINDANAO
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,