By using while loop Co.while loop, write a program that displays a list of groceries. Then, allow user to insert number of product that they want to buy, the item's code and quantity for each item. Finally, display the total price that the user needs to pay. Valid input for the number of product and quantity is positive number. and Meanwhile valid number for Items' code is only from 1 to 4. 1 Cooking oll 2 Curry powder RM 3.40 3 Detergent 4 Potato chips RM 2.50 RM 8.50 RM 3.20

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%

Please help me with this question. The question asked to write a c program using while loop and do ... while loop. Thank you :)

By using while loop o.while loop, write a program that displays a list of groceries. Then, allow user to
insert number of product that they want to buy, the item's code and quantity for each item. Finally, display the
and
total price that the user needs to pay. Valid input for the number of product and quantity is positive number.
Meanwhile valid number for Items' code is only from 1 to 4.
1 Cooking oll
2 Curry powder RM 3.40
3 Detergent
4 Potato chips
RM 2.50
RM 8.50
RM 3.20
Sample output
EMer number of product that you want to purchase (press 0 to exit): 2
1.Enter item's code that you want to buy : 3
1.Enter the quantity of item that you want to buy : 1
2.Enter item's code that you want to buy 0
2.Enter the quantity of item that you want to buy : 0
2.Enter item's code that you want to buy: 1
2.Enter the quantity of item that you want to buy 2
Total price is RM 13.50
Transcribed Image Text:By using while loop o.while loop, write a program that displays a list of groceries. Then, allow user to insert number of product that they want to buy, the item's code and quantity for each item. Finally, display the and total price that the user needs to pay. Valid input for the number of product and quantity is positive number. Meanwhile valid number for Items' code is only from 1 to 4. 1 Cooking oll 2 Curry powder RM 3.40 3 Detergent 4 Potato chips RM 2.50 RM 8.50 RM 3.20 Sample output EMer number of product that you want to purchase (press 0 to exit): 2 1.Enter item's code that you want to buy : 3 1.Enter the quantity of item that you want to buy : 1 2.Enter item's code that you want to buy 0 2.Enter the quantity of item that you want to buy : 0 2.Enter item's code that you want to buy: 1 2.Enter the quantity of item that you want to buy 2 Total price is RM 13.50
Expert Solution
steps

Step by step

Solved in 3 steps with 1 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