Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago