Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MODIFY THIS C++ PROGRAM Modify the struct so that the values for coffee name are enumerated as 1=light, 2=medium, 3=dark. Then add to the struct

MODIFY THIS C++ PROGRAM

Modify the struct so that the values for coffee name are enumerated as 1=light, 2=medium, 3=dark. Then add to the struct an attribute for coffee size that will be enumerated as small=0, regular=1, medium=2, large=3, extra-large =4. The cost is calculated as follows small $1.50, , regular $2.10, medium $2.50, large $3, extra-large $4.25. Add .25 if they choose French roast or Italian blend, add .13 for each level of sugar, and add .08 for cream. Create another struct for customer. The costumer has attributes for first name, order number which is a value between 1 and 100 inclusive, and a coffee struct. In the main program declare an array of customers that is size 100. Next create a main menu. The menu will first ask if the customer wants a cup of coffee and provide choices for yes, no or quit. If the customer chooses yes, the program should ask for the first name and store it in the appropriate location. Next, the program should display the options and allow the user to enter their preferences. Based on the customers input the cost should be calculated. Then the customers order number (array index + 1 is good for this) should be displayed. The program should keep each order in a separate array element. If in the main menu the customer chooses no then the system should ask if they want to see their order. If they choose yes then the program should ask for the order number and then display all of the appropriate information. The program should loop until the user chooses to quit in the main menu.

#include #include using namespace std;

struct Coffee { string name; float cost; int strength; bool cream; int amtofsugar; }; int main() { string quit; Coffee coffee; do {

cout<<"What type of coffee is it? Columbian, French Roast, Italian Blend, or House?"<>coffee.name; cout<<"How much does the coffee cost?"<>coffee.cost; cout<<"Enter the strength of the coffee (1-light, 2-medium, 3-dark)"<>coffee.strength; cout<<"Enter the amount of sugar (0-none, 1, 2, 3, 4) in the coffee"<>coffee.amtofsugar; cout<<"Enter 1 for cream 0 for no cream"<>coffee.cream;

cout<<"Coffe Info:"<

if(coffee.strength==1) cout<<"Strength: "<<"Light"<

else if(coffee.strength==2) cout<<"Strength: "<<"Medium"<

else cout<<"Strength: "<<"Dark"<

else cout<<"Cream: "<<"No"<

cout<<"Enter 'quit' to quit or go through the options again."<>quit; }while(quit != "quit"); system("pause"); return 0; }

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_2

Step: 3

blur-text-image_3

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

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago

Question

3. How would this philosophy fit in your organization?

Answered: 1 week ago