Question

In: Computer Science

A small tea at a certain shop costs 5QR and large tea are 15QR. Write a...

A small tea at a certain shop costs 5QR and large tea are 15QR. Write a python program that asks the user to enter the price paid for orders. When the user enters -1 the program will display the number of small tea ordered, the number of the large tea ordered, and the total cost of large tea sold.

Sample Run:

Price Paid? 5

Price Paid? 15

Price Paid? 5

Price Paid? 5

Price Paid? 15

Price Paid? -1

There were 3 small cups of tea.
There were 2 small cups of tea.

The total cost of all large tea was 30 QAR.

(using sentinel loop)

Solutions

Expert Solution

Below is the python code:

---------------------------------------------------------------------

small = 0
large = 0

while True:
print("Price Paid?", end='')
inputValue = int(input())
if inputValue == 5:
small = small + 1
elif inputValue == 15:
large = large + 1
elif inputValue == -1:
if small > 0:
print("There were", small, "small cups of tea")
if large > 0:
print("There were", large, "large cups of tea")
print("The total cost of large tree was", large*15, "QAR.")
break
---------------------------------------------------------------------------------

Code screenshot:

Output Screenshot:

  

Kindly upvote if you find this answer helpful. Thanks


Related Solutions

In Thailand, tea leaves are cultivated by a very large number of small farms that all...
In Thailand, tea leaves are cultivated by a very large number of small farms that all produce beans of similar quality and taste at similar costs. There is tons of land and the equipment required is affordable enough to allow new farming businesses to start up under current market conditions. However, with better production techniques, especially alternatives to polluting fertilisers and deforestation, are needed in this industry. Using the theory and models of industry structure, examine this industry. Should government...
You are thinking of opening a small copy shop. It costs $5,000 to rent a copier...
You are thinking of opening a small copy shop. It costs $5,000 to rent a copier for a year, and it costs $0.03 per copy to operate the copier. Other fixed costs of running the store will amount to $400 per month. You plan to charge an average of $0.10 per copy, and the store will be open 365 days per year. Each copier can make up to 100,000 copies per year. A) For one to five copiers rented and...
Fly Away Luggage Shop is a small retail establishment located in a large shopping mall. This...
Fly Away Luggage Shop is a small retail establishment located in a large shopping mall. This shop has implemented the following procedures regarding inventory items: a. Whenever Fly Away receives a shipment of new inventory, the items are taken directly to the stockroom. Fly Away’s accountant uses the vendor’s invoice to record the amount of inventory received. b. Because the shop carries high-quality, designer luggage, all inventory items are tagged with a control device that activates an alarm if a...
You are the owner of a chain of tea shop in Thailand, brewing and selling the...
You are the owner of a chain of tea shop in Thailand, brewing and selling the latest types of teas internally but buying all necessary factors from the market. Your 50 or so shops located around the city can seat around 20 patrons each and currently only sell caffeinated drinks. At this stage of growing your business you are considering vertical and horizontal integration. Using the theory of the optimal boundary of the firm, discuss the make-or-buy decision as well...
The Pat-A-Cake Pastry Shop makes chocolate cake in three sizes – Small, Medium, and Large. For...
The Pat-A-Cake Pastry Shop makes chocolate cake in three sizes – Small, Medium, and Large. For each size, the number of cakes made is an integer (i.e. the shop does not bake only half of a cake). The shop has the following amounts of the three main ingredients on hand – 400 ounces of cake flour, 550 ounces of caster sugar, and 150 ounces of cocoa powder. The table below provides details on the amount of each ingredient required for...
The Pat-A-Cake Pastry Shop makes chocolate cake in three sizes – Small, Medium, and Large. For...
The Pat-A-Cake Pastry Shop makes chocolate cake in three sizes – Small, Medium, and Large. For each size, the number of cakes made is an integer (i.e. the shop does not bake only half of a cake). The shop has the following amounts of the three main ingredients on hand – 400 ounces of cake flour, 550 ounces of caster sugar, and 150 ounces of cocoa powder. The table below provides details on the amount of each ingredient required for...
Roberts Company, a small machine shop, is contemplating acquiring a new machine that costs $24,000. Arrangements...
Roberts Company, a small machine shop, is contemplating acquiring a new machine that costs $24,000. Arrangements can be made to lease or purchase the machine. The firm is in the 40% tax bracket. The firm would obtain a 5-year lease requiring annual end-of-year lease payments of $6,000. All maintenance costs would be paid by the lessor, and insurance and other costs would be borne by the lessee. The lessee would exercise its option to purchase the machine for $1,200 at...
With external costs, is the competitive output too large or to small? With external benefits? Why...
With external costs, is the competitive output too large or to small? With external benefits? Why does this lead to an inefficient allocation of resources?
Language: Java Crust : A small pizza costs $5.99, a medium is $7.99, and a large...
Language: Java Crust : A small pizza costs $5.99, a medium is $7.99, and a large is $9.99. A handtossed crust is an additional $0.50, and a deep dish pan crust is an additional $1.00. Do a CrustSize enum [S(5.99), M(7.99), and L(9.99)] and a CrustType enum [THIN(0.00), HAND(0.50), and PAN(1.00)]. Place your enums in CrustEnum.java. Both enums should have cost methods. Do a Crust class with a constructor that accepts and sets the crust size and type, and provide...
Pick a small company (ice-cream shop, restaurant, bookstore, parking structure or ...) and write a short...
Pick a small company (ice-cream shop, restaurant, bookstore, parking structure or ...) and write a short history about the company, major products, and location. Determine the factors that will influence demand for their products (be specific) Determine the factors that will influence supply of their products (be specific) Pick one of their products andeither calculate or speculate about the price elasticity of demand and the income elasticity of demand for that product. Justify your guess about how elastic the demand...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT