Question: PLEASE HURRY!!! Task 4: Write a function named displayOutput. (10.5 marks) a) This is a non-returning function. b) It takes an array of Item of
PLEASE HURRY!!!
Task 4: Write a function named displayOutput. (10.5 marks) a) This is a non-returning function. b) It takes an array of Item of type struct and the number of items calculated in Task 2 as input parameters. c) The function should display items' code, name, cost, sale price, number of items sold, and profit. The formula for calculating item profit is as follows: Item profit = Number of items sold * (Sale price - Cost) d) Figure 2 shows an example of the output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. CODE ITEM NAME COST (RM) SALE (RM) QUANTITY PROFIT (RM) M101 B202 C303 F404 F404 C303 B202 M101 M101 C303 B202 F404 M101 C303 B202 Double Mushroom Double BBQ Beef Grilled Chicken Fish'n Crisp Fish'n Crisp Grilled Chicken Double BBQ Beef Double Mushroom Double Mushroom Grilled Chicken Double BBQ Beef Fish'n Crisp Double Mushroom Grilled Chicken Double BBQ Beef 11.50 10.20 7.00 6.25 6.25 7.00 10.20 11.50 11.50 7.00 10.20 6.25 11.50 7.00 10.20 14.95 13.26 9.10 8.12 8.12 9.10 13.26 14.95 14.95 9.10 13.26 8.12 14.95 9.10 13.26 12 21 15 9 27 25 16 9 14 26 31 13 9 38 33 41.40 64.26 31.50 16.88 50.62 52.50 48.96 31.05 48.30 54.60 94.86 24.38 31.05 79.80 100.98 Figure 2: Expected output for Task 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
