subject
Computers and Technology, 24.05.2021 17:30 leo4687

Working with do-while loop Bring the program dowhile. cpp from the Lab 5 folder.
The code is shown below:

// This program displays a hot beverage menu and prompts the user to
// make a selection. A switch statement determines which item the user
// has chosen. A do-while loop repeats until the user selects item E
// from the menu.
// PLACE YOUR NAME HERE
#include
#include
using namespace std;
int main()
{
// Fill in the code to define an integer variable called number,
// a floating point variable called cost,
// and a character variable called beverage
bool validBeverage;
cout << fixed << showpoint << setprecision(2);
do
{
cout << endl << endl;
cout << "Hot Beverage Menu" << endl << endl;
cout << "A: Coffee $1.00" << endl;
cout << "B: Tea $ .75" << endl;
cout << "C: Hot Chocolate $1.25" << endl;
cout << "D: Cappuccino $2.50" << endl < cout << "Enter the beverage A, B,C, or D you desire" << endl;
cout << "Enter E to exit the program" << endl << endl;
// Fill in the code to read in beverage
switch(beverage)
{
case 'a':
case 'A':
case 'b':
case 'B':
case 'c':
case 'C':
case 'd':
case 'D': validBeverage = true;
break;
default: validBeverage = false;
}
if (validBeverage == true)
{
cout << "How many cups would you like?" << endl;
// Fill in the code to read in number
}
// Fill in the code to begin a switch statement
// that is controlled by beverage
{
case 'a':
case 'A': cost = number * 1.0;
cout << "The total cost is $ " << cost << endl;
break;
// Fill in the code to give the case for tea ( $0.75 a cup)
//Fill in the code to give the case for hot chocolate($1.25 a cup)
// Fill in the code to give the case for cappuccino ($2.50 a cup)
case 'e':
case 'E': cout << " Please come again" << endl;
break;
default:cout << // Fill in the code to write a message
// indicating an invalid selection.
cout << " Try again please" << endl;
}
} // Fill in the code to finish the do-while statement with the
// condition that beverage does not equal (E or e).
// Fill in the appropriate return statement
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 17:00
What does the faves button do? a. users mark a web page as a favorite b. leads other readers to favor a specific page c. readers sort and align their favicons, or favorite icons d. leads users to a message board where they can post questions
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
What multimedia system creates an immersive, real-life experience that the user can interact with?
Answers: 1
question
Computers and Technology, 24.06.2019 09:10
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
question
Computers and Technology, 24.06.2019 10:00
Each time you save a document, you will need to type in the file type in which it should be saved you can select the save button to save it with the same file name if it has been previously saved you will need to select the location to save the file you will need to use the save as dialog box
Answers: 1
You know the right answer?
Working with do-while loop Bring the program dowhile. cpp from the Lab 5 folder.
The code is...
Questions
question
Mathematics, 21.08.2019 15:50
question
Mathematics, 21.08.2019 15:50
question
Mathematics, 21.08.2019 15:50
Questions on the website: 13722367