Question

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 total amount of coffee sold.

4.At any time show the total money made.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def buyCoffee(cupsDict):
    print('1. Small coffee cup(9oz)')
    print('2. Medium coffee cup(12oz)')
    print('3. Large coffee cup(15oz)')
    print('Enter your choice: ')
    s = 'SML'[int(input()) - 1]
    print('Enter quantity: ')
    q = int(input())
    cupsDict[s] = q + cupsDict.get(s, 0)

def totalCoffeeSold(cupsDict):
    a = 0
    a += 9 * cupsDict.get('S', 0)
    a += 12 * cupsDict.get('M', 0)
    a += 15 * cupsDict.get('L', 0)
    return a

def totalMoneyMade(cupsDict):
    a = 0
    a += 1.75 * cupsDict.get('S', 0)
    a += 1.90 * cupsDict.get('M', 0)
    a += 2.00 * cupsDict.get('L', 0)
    return a

def totalCupsSold(cupsDict):
    print('Small Cups:', cupsDict.get('S', 0))
    print('Medium Cups:', cupsDict.get('M', 0))
    print('Large Cups:', cupsDict.get('L', 0))



cupsSold = {}

choice = 0
while choice != 5:
    print('Enter your choice: ')
    print('1.Buy coffee in any size and in any number of cups')
    print('2.Show the total number of cups of each size sold.')
    print('3.show the total amount of coffee sold.')
    print('4.show the total money made')
    print('5.Quit')

    choice = int(input())

    if choice == 1:
        buyCoffee(cupsSold)
    elif choice == 2:
        totalCupsSold(cupsSold)
    elif choice == 3:
        print('Total coffee sold:', totalCoffeeSold(cupsSold))
    elif choice == 4:
        print('Total money: ', totalMoneyMade(cupsSold))


Please upvote, as i have given the exact answer as asked in question. Still in case of any concerns in code, let me know in comments. Thanks!

Add a comment
Know the answer?
Add Answer to:
Write for python: Jason opened a coffee shop at the beach and sells coffee in three...
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...

  • 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...

  • 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)

  • Order up:: Write a program that will be used to keep track of orders placed at...

    Order up:: Write a program that will be used to keep track of orders placed at a donut shop. There are two types of items that can be ordered: coffee or donuts. Your program will have a class for each order type, and an abstract superclass. Coffee orders are constructed with the following information: quantity (int) - how many coffees are being ordered size (String) - the size of the coffees (all coffees in the order have the same size)...

  • Consider the information provided in the Hot Coffee Lawsuit. What might be the possible implications for...

    Consider the information provided in the Hot Coffee Lawsuit. What might be the possible implications for the Restaurant Industry? What might be a long term impact? In 1992, Stella Liebeck spilled scalding McDonald's coffee in her lap and later sued the company, attracting a flood of negative attention. It turns out there was more to the story. The case is now famous but when Stella Liebeck burnt McDonald's coffee she would never know that it would still be talked about...

  • Question 1 (40 marks) Refer to Table 1. Write the Excel formula for each cell marked...

    Question 1 (40 marks) Refer to Table 1. Write the Excel formula for each cell marked with "" in column C such that formula could be copied and pasted into columns D, and E using Microsoft Excel without further editing, There is no need to explicitly write the Excel formula for cells marked with "Copy & paste". Label each formula clearly with cell reference position. In many country towns of China, there is no western coffee shop such as Starbucks...

  • Best friends, decided to start their own business which would bring great coffee from all over...

    Best friends, decided to start their own business which would bring great coffee from all over the world to their local community. Together they have formed Classic Coffee Company, or CCC (assume their coffee shop is located a few miles from our college campus). Nathan is selecting and making the coffee they serve. Cody manages the front and back office; selling coffee to customers, paying employees, and running ads for the coffee shop. Last year, the company sold 48,800 units...

  • Karges Coffee Inc. manufactures a line of single-cup brewing machines for home and office use that...

    Karges Coffee Inc. manufactures a line of single-cup brewing machines for home and office use that brew a cup of coffee, tea, or hot chocolate in less than a minute. The machines use specially packaged portions of coffee, tea, or hot chocolate that can be purchased online directly from Karges or at specialty coffee shops licensed to distribute the company’s products. The appeal of the brewing machines is twofold. First, they offer a high level of convenience. The use of...

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
ADVERTISEMENT