Question: Write a program that asks the user to enter the discount percentage and the number of products and depending on this number he will be
Write a program that asks the user to enter the discount percentage and the number of products and depending on this number he will be asked to enter information of each product (check sample runs) For each product the program must ask the user to enter the product price and category. The category is 'D' for discounted and 'N' for not discounted products. After all information is entered the program should display the following: The number for discounted products The total price before and after the discount for discounted products, note that: Total price after discount total price before discount"(1-discount/100) The number for not discounted products The total price for not discounted products The total for all products Note that the number of products should be positive, if the user enters an invalid value (zero or negative), the program will display "Wrong input, you should enter a positive number" and then stop, Sample Run 1 Enter the discount percentage: 10 Enter the number of products: 6 Enter price and category for product 1: 1000 D Enter price and category for product 2: 2000 N Enter price and category for product 3: 5000 D Enter price and category for product 4: 3000 N Enter price and category for product 5: 4000 D Enter price and category for product 6: 8000 D 4 discounted product, total before discount-18000, total after discount=16200 2 not discounted product, total 5000 Total 21200 Sample Run 2 Enter the discount percentage: 10 Enter the number of products: 2 Wrong input, you should enter a positive number
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
