An ice cream manufacturer supplies different types of ice cream to the local restaurant in different sizes of containers weighing in grams. The price for each container is given in the table below: Container (in gram) Price (RM) 10.0 18.0 50.0 80.0 135.0 50 100 350 700 1400 Write a program that reads in the weight of the ice cream ordered by the customer and displays the ice cream price. Your program will calculate the best combination of the containers to provide the lowest price. For example, if the customer orders 2.5 kg of ice cream, then the program should use 1x1400gram + 1x700gram + 1x350gram + 1x50gram.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 21PE
icon
Related questions
Question

python programming

 

An ice cream manufacturer supplies different types of ice cream to the local restaurant in
different sizes of containers weighing in grams. The price for each container is given in the
table below:
Container (in gram) Price (RM)
10.0
18.0
50.0
80.0
135.0
50
100
350
700
1400
Write a program that reads in the weight of the ice cream ordered by the customer and displays
the ice cream price. Your program will calculate the best combination of the
containers to provide the lowest price. For example, if the customer orders 2.5 kg of ice
cream, then the program should use 1x1400gram + 1x700gram + 1x350gram + 1x50gram.
The program will suggest the best container for the remaining gram that is unable to be packed
with any containers. For example, if the input gram is 1000 grams, then the system will choose
1x700 grams container and the remaining 300 grams will be suggested by the system to upgrade
it to the nearest container (in this case 350 grams container). However, the user can reject the
suggestion and the remaining gram of ice cream will be ignored in the overall calculation.
The system will let the user choose two types of discount options namely percentage sales and
cash discount. The sales percentage discount is as follows:
Sales Amount (RM)
<1000
1000-3000
>3000
Discount
2%
5%
10%
For the cash discount, the system will use the following coupon code for the direct price-off
incentive:
Coupon code
IC50
IC100
IC200
Direct Price-off
RM50 with a minimum spend of 700
RM100 with a minimum spend of 500
RM200 with a minimum spend of 4000
The system will reject any coupon code if the total purchased amount is below the stated
minimum spending amount or if any invalid coupon code is entered. The system will print out
the receipt (Figure 1.0) to the user including the 5% government sales tax
The system will prompt the user for the next transaction upon the sales receipt is printed. For
example:
Next Order [Y/N]: y
Transcribed Image Text:An ice cream manufacturer supplies different types of ice cream to the local restaurant in different sizes of containers weighing in grams. The price for each container is given in the table below: Container (in gram) Price (RM) 10.0 18.0 50.0 80.0 135.0 50 100 350 700 1400 Write a program that reads in the weight of the ice cream ordered by the customer and displays the ice cream price. Your program will calculate the best combination of the containers to provide the lowest price. For example, if the customer orders 2.5 kg of ice cream, then the program should use 1x1400gram + 1x700gram + 1x350gram + 1x50gram. The program will suggest the best container for the remaining gram that is unable to be packed with any containers. For example, if the input gram is 1000 grams, then the system will choose 1x700 grams container and the remaining 300 grams will be suggested by the system to upgrade it to the nearest container (in this case 350 grams container). However, the user can reject the suggestion and the remaining gram of ice cream will be ignored in the overall calculation. The system will let the user choose two types of discount options namely percentage sales and cash discount. The sales percentage discount is as follows: Sales Amount (RM) <1000 1000-3000 >3000 Discount 2% 5% 10% For the cash discount, the system will use the following coupon code for the direct price-off incentive: Coupon code IC50 IC100 IC200 Direct Price-off RM50 with a minimum spend of 700 RM100 with a minimum spend of 500 RM200 with a minimum spend of 4000 The system will reject any coupon code if the total purchased amount is below the stated minimum spending amount or if any invalid coupon code is entered. The system will print out the receipt (Figure 1.0) to the user including the 5% government sales tax The system will prompt the user for the next transaction upon the sales receipt is printed. For example: Next Order [Y/N]: y
Container
1400
700
[Yummy Ice Cream Supplier]
Quantity
2
1
Figure 1.0: Sales Receipt
Unit Price
135.00
80.00
Discount (2%)
Sales Tax (5%)
TOTAL
Total (RM)
270.00
80.00
350.00
7.00
343.00
17.15
360.15
The program should be developed in a modular way using the functions, parameters, and
returns value to eliminate redundancy.
Give meaningful names to variables, and use proper indentation and whitespace. Follow
Python's naming standards as specified in the lecture. Localize variables when possible;
declare them in the smallest scope needed. Include meaningful comment headers at the top of
your program and the start of each function. Limit line lengths to 100 chars. Consider using
some customized functions to reduce code redundancy and promote code reusability.
Transcribed Image Text:Container 1400 700 [Yummy Ice Cream Supplier] Quantity 2 1 Figure 1.0: Sales Receipt Unit Price 135.00 80.00 Discount (2%) Sales Tax (5%) TOTAL Total (RM) 270.00 80.00 350.00 7.00 343.00 17.15 360.15 The program should be developed in a modular way using the functions, parameters, and returns value to eliminate redundancy. Give meaningful names to variables, and use proper indentation and whitespace. Follow Python's naming standards as specified in the lecture. Localize variables when possible; declare them in the smallest scope needed. Include meaningful comment headers at the top of your program and the start of each function. Limit line lengths to 100 chars. Consider using some customized functions to reduce code redundancy and promote code reusability.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning