Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A grocery store sells food based on either the number of units or the weight. For example, apples are sold by the kilogram while boxes
A grocery store sells food based on either the number of units or the weight. For example, apples are sold by the kilogram while boxes of juice are sold based on the number of units the customer wishes to purchase. The store offers a discount for large purchases: - If the number of units of specific item is greater than 5, the customers gets one of them for free. For example, the customer buys 7 juice boxes pays for 6. If the weight of a product is greater than 3 kg, the customer gets 10% discount on that particular product. For example, the customer buys 3.5 kg of apples - pays 90% of the price for the apples. The store needs a program to calculate the total bill for each customer. Such program will read a list of items purchased and the number of units or weight of each item. Each line in the bill consists of: ProductName ProductPrice Unit/WeightIndicator Quantity/Weight The list of items will be terminated by "end" keyword. The data will look like this: Juice 10 unit 7 Apples 3 weight 3.5 Cereal 5 unit 3 Gum 1 unit 15 Pears 3.5 weight 5 end The program should read the data from the console, calculate the total price of the items purchased and print it out. Deliverables You should show the working program to your instructor before leaving the lab
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started