Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

please paste the code below with a screenshot of the output write comments in the code. thanks in advance Problem Write a C program that

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

please paste the code below with a screenshot of the output

write comments in the code.

thanks in advance

Problem Write a C program that calculates the sale price of products. The program design should use a main and the below six functions. Consider the constant SIZE with value equal to 3 and a one-dimensional array A_cost with size equal to SIZE that represents the products cost in KWD. 1. Define a function O_read_1 that takes a 10 array A_cost and 1D array A_percentage as formal parameters. The function should perform the following: (20 points) Prompts the user to fill the array A_cost with the following product costs: 20.05 60.32 10.54 Prompts the user to fill the array A_percentage with product percentages increase as shown below. 0.20 0.10 0.05 2. Define a function O_sale_1 that takes a 10 array A_cost, 10 array A_percentage and A_saleprice as formal parameters. The function should perform the followings: (15 points) Calculates sale price for each product in the array A_saleprice as shown below using the following formula: Sale Price = Cost X (1+percentage increase) 22.06 63.34 12.65 3. Define a function O_result_1 that takes a 10 array A_saleprice of size equal to SIZE as formal parameter. The function calculates and prints the cheapest and the expensive sale prices in the array A_saleprice as shown below: (15 points) CHEAPEST and EXPENSIVE ITEM PRICES : Cheapest iten price: 12.65 Expensive item price: 63.34 4. Define a function O_afterdiscount_1 that takes a 10 array A_saleprice of size equal to SIZE as formal parameters. The function calculates the new prices after applying the following discounts (20 points): 5% discount if sale price greater than or equal 100 10% discount if sale price greater than 50 and less than 100 15% discount if sale price less than or equal 50 5. Define a function O_print_1 that takes A_cost, and A_saleprice as formal parameters and displays all arrays' elements as shown in the below sample output. (10 points) 6. Define a function O_student_1 that displays your name, your CS 159 section number and your ID on the screen as shown in the below figure. (10 points) *************** Name : XXXX YYYY WWW ********* Section: xx *-*-*-*-*-*-*-* ID: 12345 W-W-WWW-N-N- 7. Write a main function that performs the following: (10 points) Define and initialize the arrays A_cost, A_percentage and A_saleprice. Display the below sample output as by calling the following functions: O_read_1, 0_sale_1, O_result_1 and O_print_1. A complete sample output of the program is given below in the figure: Enter the product costs for each iten: 20.05 60.32 10.54 Enter the percentage for each item : 0.10 0.05 0.20 COSTS OF THE ITEMS (KWD) Iten Item 1 Item 2 20.05 60.32 19.54 PERCENTACE OF THE ITEM (KWD) Item 9 Item 1 Item 2 0.10 0.05 0.20 SALE PRICE OF THE ITEM (KWD) Iten 0 Item 1 Item 2 22.06 63.34 12.65 CHEAPEST and EXPENSIVE ITEM PRICES Cheapest item price: 12.65 Expensive iten price: 63.34 RESULTS AFTER APPLYING DISCOUNTS: COSTS OF THE ITEMS (KWD) Iten 0 Item 1 Item 2 20.05 60.32 10.54 PERCENTACE OF THE ITEM (KWD) Item 9 Item 1 Item 2 9.10 0.05 0.20 SALE PRICE OF THE ITEM (KWD) Iten 9 Item 1 Item 2 18.75 57.00 10.75 Nane : XXXX YYYY *WWW-W-W-W-W-*-*-* *************** *********** Section! xx ID: 12345 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

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_2

Step: 3

blur-text-image_3

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

Intelligent Information And Database Systems Asian Conference Aciids 2012 Kaohsiung Taiwan March 2012 Proceedings Part 2 Lnai 7197

Authors: Jeng-Shyang Pan ,Shyi-Ming Chen ,Ngoc-Thanh Nguyen

2012th Edition

3642284892, 978-3642284892

More Books

Students explore these related Databases questions

Question

What is nonfinancial compensation?

Answered: 3 weeks ago