Question

In: Computer Science

(Python Programming) You are asked to develop a cash register for a fruit shop that sells...

(Python Programming)

You are asked to develop a cash register for a fruit shop that sells oranges and apples. The program will first ask the number of customers. Subsequently, for each customer, it will ask the name of the customer and the number of oranges and apples they would like to buy. And then print a summary of what they bought along with the bill as illustrated in the session below:

How many customers?  2    
Name of Customer 1  Harry  
Oranges are $1.40 each. 
How many Oranges?  1  
Apples are $.75 each. 
How many Apples?  2  
Harry, you bought 1 Orange(s) and 2 Apple(s).  
Your bill is $2.9    
Name of Customer 2  
Sandy  
Oranges are $1.40 each. 
How many Oranges?  10  
Apples are $.75 each. 
How many Apples?  4  
Sandy, you bought 10 Orange(s) and 4 Apple(s).  
Your bill is $17.0

Solutions

Expert Solution

#it will ask user to enter no of customer and store it in noOfCustomers
noOfCustomers = int(input("How many customers? "))

#as many customers we have, this loop will executes that many times
for i in range(noOfCustomers):
    
    #it will ask for Customer's name and store it in name variable
    name = input("Name of Customer " + str(i+1) + " ")
   
    #displays cost of oranges
    print("Oranges are $1.40 each.")
    
    #it will ask user how many oranges needed and stored it in oranges
    oranges = int(input("How many Oranges? "))
    
    #displays cost of apples
    print("Apples are $.75 each.")
    
    #it will ask user how many apples needed and stored it in apples
    apples = int(input("How many Apples? "))
    
    #prints number of apples and oranges bought by customer
    print(name + ", you bought " + str(oranges) +" Orange(s) and " + str(apples) + " Apple(s).")
    
    #count a bill
    amt = 1.40 * oranges + 0.75 * apples
    
    #print a bill
    print("Your bill is $" + str(amt))
    
    
    

Code Screenshots :

Output sample :


Related Solutions

Python Programming Question Bicycle shop. A bicycle shop sells bikes and helmets. Some people already own...
Python Programming Question Bicycle shop. A bicycle shop sells bikes and helmets. Some people already own helmets, so on average the shop sells three helmets for every five bicycles. Helmets cost $50 and bikes cost $250. Write a program that prompts for the number of bikes that the shop expects to sell over the next month and outputs the total amount of expected revenue. You should not be using eval() at all; use int() or float() instead when called for.
In PYTHON : as basic as possible Write a program that acts as a cash register....
In PYTHON : as basic as possible Write a program that acts as a cash register. The program will prompt how many items they are buying. Then they will input the price of each item (these should be decimal numbers). The program will display the SUBTOTAL, TAX ADDED (13%), and the TOTAL (with tax). Make sure you include $ signs and round to two decimal places ] Sample Output: How many items are you buying? 3 Enter in a price:...
C++ Programming Enum - Structure - Array You are asked to develop software for HR department...
C++ Programming Enum - Structure - Array You are asked to develop software for HR department to calculate employee’s weekly salary. The program should contain the following information about a student by declaring a struct: Name (string of characters)        Employee ID (string of characters)        Level (ENGINEER, MANGER, DIRECTOR)        Hourly Rate (floating-point number)        Working Hours (floating-point number)        Weekly Salary (floating-point number) Your program will read an employee data and print the information of employee’s Name, Employee...
Homework 3 Loop and Function (PYTHON) You are asked to develop a compensation calculator application for...
Homework 3 Loop and Function (PYTHON) You are asked to develop a compensation calculator application for a department store. At the department store, the compensation of sales staff consists of a base salary and a commission. The base salary is $5,000, and the commission rate is tiered based on sales amount as following: Sales AmountCommission Rate $0.01 – $5,000 8% $5,000.01 – $10,000 10% $10,000.01 and above12% For example, if the sales amount is $12,000, the commission is calculated as...
1a. You have been asked to develop a pro forma statement of cash flow for an...
1a. You have been asked to develop a pro forma statement of cash flow for an office plaza. The information given to you is listed below: Property Information:                Age                                                                                        8 years                Rentable Space                                                                 300,000 sq.ft.                 # Stories                                                                              15                 # Tenants                                                                            40     Financial Information:                 Base Rent Avg.                                                                  $20 per sq.ft.                 Other Income/Parking                                                   $1.50 per sq.ft.                 Expenses Recoverable from Tenants                       $2.50 per sq.ft.                 Current Vacancy                                                               equals to 5% of...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
Python Problem Problem 1: In this problem you are asked to write a Python program to...
Python Problem Problem 1: In this problem you are asked to write a Python program to find the greatest and smallest elements in the list. The user gives the size of the list and its elements (positive and negative integers) as the input. Sample Output: Enter size of the list: 7 Enter element: 2 Enter element: 3 Enter element: 4 Enter element: 6 Enter element: 8 Enter element: 10 Enter element: 12 Greatest element in the list is: 12 Smallest...
What do you know about programming in Python? What is the difference between Python and Java?
What do you know about programming in Python? What is the difference between Python and Java? What does the term Open Source mean? Name four examples of Open Source software. What is the IDEL programming environment? How does IDEL relate to Python? How do you spread a long statement over multiple lines in Python? How do you use the loop-index? How will knowing and understanding Python impact what you do in your profession and/or personal experiences?
Python Programming, Could you also show the right indents in Python Shell. Below are the skeleton...
Python Programming, Could you also show the right indents in Python Shell. Below are the skeleton of the program, and the input and output. # Initialize list mylist = [ ] # Set up loop to put menu on screen num = 1 while num != 0:      print(" ")     print(" ")     print("            Menu ")      print ("0 - Quit")     print ("1 - Add item to list")     print ("2 - Pop item off list and print...
In this assignment, you will develop a simple Web server in Python that is capable of...
In this assignment, you will develop a simple Web server in Python that is capable of processing only one request. Specifically, your Web server will (i) create a connection socket when contacted by a client (browser); (ii) receive the HTTP request from this connection; (iii) parse the request to determine the specific file being requested; (iv) get the requested file from the server’s file system; (v) create an HTTP response message consisting of the requested file preceded by header lines;...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT