program5_1.py Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends. Sample Output How many different items are being purchased? 2 Enter description of item 1 dinner Enter price of item 1 2.97 Enter the quantity for item 1 2 Item: dinner, subtotal: $5.94 Enter description of item 2 milk Enter price of item 2 3.29 Enter the quantity for item 2 3 Item: milk, subtotal: $9.87 Your total is $15.81

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

program5_1.py
Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item descriptionprice and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends. 

program5_1.py
Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then
starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be
passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return
it to main. The total should be printed in main after the loop ends.
Sample Output
How many different items are being purchased?
Enter description of item 1 dinner
Enter price of item 1 2.97
Enter the quantity for item 1 2
Item: dinner, subtotal: $5.94
Enter description of item 2 milk
Enter price of item 2 3.29
Enter the quantity for item 2 3
Item: milk, subtotal: $9.87
Your total is $15.81
Transcribed Image Text:program5_1.py Write a program that operates like a cashier terminal in a grocery store. It begins by prompting for the number of different items being purchased and then starts a loop. In the loop, the program should prompt for the item description, price and quantity of each item being purchased. These three values should be passed as arguments to a custom function that is defined in a separate module file. The imported function should print the subtotal for the item and return it to main. The total should be printed in main after the loop ends. Sample Output How many different items are being purchased? Enter description of item 1 dinner Enter price of item 1 2.97 Enter the quantity for item 1 2 Item: dinner, subtotal: $5.94 Enter description of item 2 milk Enter price of item 2 3.29 Enter the quantity for item 2 3 Item: milk, subtotal: $9.87 Your total is $15.81
Expert Solution
Directory structure

Computer Engineering homework question answer, step 1, image 1

both program5_1.py and subtotal.py should be in same directory. You can name the directory whatever you want. But make sure you don't change the name "subtotal.py". If you change it, then also modify the import statement in the first line of program5_1.py

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY