Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

with stdio.h Write a program (main) that gives a discount on products. Prompt the user to enter the product number. Prompt the user to enter

with stdio.h
image text in transcribed
Write a program (main) that gives a discount on products. Prompt the user to enter the product number. Prompt the user to enter either 1 (for amount) or 2 (for kilogram). Call get_price function. If the user enters 1 , prompt the user to enter the quantity of product. Call tocalprice function. - Call discount function to make discount on the total price according to the amount of the product. 0. If the user enters 2, prompt the user to enter the kilogram of the product. Call totalprice function. - No discount Display the total payment. The program has three functions: get price, totalprice, and discount. Here are the prototypes for the three functions: float get price(int productNo, int amountType); Returns the list price of the product. Suppose that product has the list price shown in the following table: Hoat totalprice(float amount, float 1istprice); Calculates the total price. float discount(float total price, int anount); Returns the price after making the discount. Suppose that discount is shown in the following table

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

More Books

Students also viewed these Databases questions