Question

Problem analysis and algorthim design please Jason opened a coffee shop at the beach and sells...

Problem analysis and algorthim design please

Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz), medium (12oz), and large (15oz). The cost of one small cup is $1.75, one medium cup is $1.90, and one large cup is $2.00. Write a menu-driven program that will make the coffee shop operational. Your program should allow the user to do the following:

a. Buy coffee in any size and in any number of cups.
b. At any time show the total number of cups of each size sold.c. At any time show the total amount of coffee sold.
d. At any time show the total money made.

Your program should consist of at least the following functions: a function to show the user how to use the program, a function to sell coffee, a function to show the number of cups of each size sold, afunction to show the total amount of coffee sold, and a function to show the total money made. Your program should not use any global variables and special values such as coffee cup sizes and cost of a coffee cup must be declared as named constants.

C++

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
#include <fstream>

using namespace std;

int main() {
int small=0,med=0,large=0,total=0;
int flag=0,n,opt;
double cost,tmoney=0;
while(flag==0){
cout<<"Menu for Day!!!!"<<endl;
cout<<"Coffee size enter \n 1.for small \n2.for medium\n3.for large"<<endl;
cout<<"your option: ";
cin>>opt;
switch(opt){
case 1:
cout<<"Enter number of cups: ";
cin>>n;
total=total+n*9;
small=small+n;
cost=(double)n*1.75;
cout<<"Your bill is: "<<cost<<endl;
tmoney=tmoney+cost;
break;
case 2:
cout<<"Enter number of cups: ";
cin>>n;
total=total+n*12;
med=med+n;
cost=(double)n*1.90;
cout<<"Your bill is: "<<cost<<endl;
tmoney=tmoney+cost;
break;
case 3:
cout<<"Enter number of cups: ";
cin>>n;
total=total+n*15;
large=large+n;
cost=(double)n*2.00;
cout<<"Your bill is: "<<cost<<endl;
tmoney=tmoney+cost;
break;
case 4:
cout<<"Quitting !!!!!"<<endl;
flag=1;
break;

}
cout<<"Number of cups of small size sold: "<<small<<endl;
cout<<"Number of cups of medium size sold: "<<med<<endl;
cout<<"Number of cups of large size sold: "<<large<<endl;
cout<<"Total amount of coffe sold: "<<total<<"oz"<<endl;
cout<<"Money made till now: $"<<tmoney<<endl;
}
}.

Add a comment
Know the answer?
Add Answer to:
Problem analysis and algorthim design please Jason opened a coffee shop at the beach and sells...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz),...

    Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz), medium (12oz), and large (15oz). The cost of one small cup is $1.75, one medium cup is $1.90, and one large cup is $2.00. Write a menu-driven program that will make the coffee shop operational. Your program should allow the user to do the following: a. Buy coffee in any size and in any number of cups. b. At any time show the total...

  • Write for python: Jason opened a coffee shop at the beach and sells coffee in three...

    Write for python: Jason opened a coffee shop at the beach and sells coffee in three sizes: small (9oz), medium (12oz), and large (15oz). The cost of one small cup is $1.75, on e medium cup is $1.90, and one large cup is $2.00. Program should allow to do the following: 1.Buy coffee in any size and in any number of cups 2.At any time show the total number of cups of each size sold. 3.At any time show the...

  • C++ question: Jason opened a coffee shop selling coffee, cheese cakes, and coffee beans. Coffee is...

    C++ question: Jason opened a coffee shop selling coffee, cheese cakes, and coffee beans. Coffee is sold at the shop in two sizes: small (9 oz, $1.5) and large (12 oz, $1.9). Cheese cakes cost $3 per slice. Coffee beans are sold with $0.6 per oz. Write a menu-driven program that will make the coffee shop operational. Your program should allow the user to do the following: Choose among coffee, cakes, or beans to purchase. Buy coffee in any size...

  • Using C#, write a program. You are a coffee and tea shop. You will allow customers...

    Using C#, write a program. You are a coffee and tea shop. You will allow customers to enter their orders. You sell coffee and tea in three sizes, small coffee for $1.00, medium for $1.20, and large for $1.40. Tea is $1.20, $1.40, and $1.60. You will let ask the user what they want, size, ask if they want to order anything else, continue taking their order. At the end show them how much they owe. If they order more...

  • 3. The first coffee shop in LH (a small town of ten thousand residents in the...

    3. The first coffee shop in LH (a small town of ten thousand residents in the Midwest) is opening in a month. The store is selling freshly brewed coffee in three sizes: small (5 fl. oz.), medium (8 fl. oz.) and large (11 fl. oz.), and the cost of the coffee is 10 cents per fl. oz. The marketing research that the storeowner, Luc, conducted show that there are four thousand people who drink coffee in this town, and they...

  • Pyhton Program : Write a coffee vending machine class. Include fields giving the number of cups...

    Pyhton Program : Write a coffee vending machine class. Include fields giving the number of cups of coffee available, the cost of one cup of coffee, and the total amount of money inserted by the user. This machine requires exact change. Include one constructor which stocks the machine with a quantity and price of coffee specified as parameters. Include the following methods; menu() // display the quantity and price of coffee insert(int quarters, int dimes, int nickels) // insert the...

  • need 5-9 please Jason believes that the sales of his coffee shop depend upon the weather....

    need 5-9 please Jason believes that the sales of his coffee shop depend upon the weather. He has taken a sample of 5 days Below you are given the results of the sample Temp Cups of coffee sold 700 50 60 500 70 400 80 200 100 90 -You are going to conduct a simple linear regression analysis using this data I. What is the dependent variable? Options-weather,temperature,coffee shops days,cups of coffiee 2. First calculate the value of bl. If...

  • At Starbucks, there are three sizes of coffee drinks, Small (200 ml), Regular (400 mL) and...

    At Starbucks, there are three sizes of coffee drinks, Small (200 ml), Regular (400 mL) and Large (800 mL), and they cost $2.25, 53.75, and $5.75, Respectively. On one evening Starbucks sold 39 coffees, the total volume of the coffee sold was 19,800 mL, and the amount of money made in coffee sales was $129. Using Cramer's rule how many of each size of coffee did customers buy that evening? (Submit your solution BY your HAND-writing)

  • write a C++ program that sells candy and drinks using the enumeration type. You must use...

    write a C++ program that sells candy and drinks using the enumeration type. You must use the following within your program: enum sizes {SMALL, MEDIUM, LARGE, JUMBO}; sizes Candysize, drinkSize; You should create a menu that asks the user to choose what size of drink they want and to choose what size of popcorn they want. Then I have to print out the total cost of the drink and popcorn. The Prices: Candy Soda Small 1.25 1.50 Medium 2.25 2.50...

  • JIz Instructions Question 6 10 pts Suppose Sue's monthly demand equation for coffee is Q =...

    JIz Instructions Question 6 10 pts Suppose Sue's monthly demand equation for coffee is Q = 30 - 3P, and the price is $4/cup. Show all calculation steps for your answer to the following questions: a) How many cups of coffee will Sue buy in one month? What is the marginal value for the last cup she consumes? b) How much is Sue's total value from consumption? How much is her consumer surplus? c) Suppose the coffee shop has a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT