Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer the question using C language and it is urgent thank you float totalPrice(float amount, float listPrice); Calculates the total price. float discount(float total_price,

please answer the question using C language and it is urgent thank you image text in transcribedimage text in transcribed

float totalPrice(float amount, float listPrice); Calculates the total price. float discount(float total_price, int amount); Returns the price after making the discount. Suppose that discount is shown in the following table: cted output(s): Enter the product number (1 for peach, 2 for pear, 3 for plum): 2 Enter 1 for amount, 2 for kilogram: 1 Enter the quantity: 1 The total is $0.99 Enter the product number ( 1 for peach, 2 for pear, 3 for plum): 2 Enter 1 for amount, 2 for kilogram: 2 How many kilograms: 5 The total is $24.95 Enter the product number ( 1 for peach, 2 for pear, 3 for plum): 2 Enter 1 for amount, 2 for kilogram: 1 Enter the quantity: 4 The total is $3.76 Enter the product number (1 for peach, 2 for pear, 3 for plum): 2 Enter 1 for amount, 2 for kilogram: 1 Enter the quantity: 7 The total is $6.24 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 totalprice function. - Call discount function to make discount on the total price according to the amount of the product. O 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

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

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago