Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP PLZ URGENTLY NEEDED!! Code M101 B202 C303 F404 Table 1 1 Name Double Mushroom Double BBQ Beef Grilled Chicken Fish'n Crisp Cost (RM) 11.5

HELP PLZ

URGENTLY NEEDED!!

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

Code M101 B202 C303 F404 Table 1 1 Name Double Mushroom Double BBQ Beef Grilled Chicken Fish'n Crisp Cost (RM) 11.5 10.0 10.2 12.5 Write a complete C++ program The program uses various types of structured data developed to calculate the profit of each item, the total amount of profit, and the highest profit. The program should perform the following tasks: (3 marks) Task 1: Declare a structure named Item, with the following members: a) Code b) Name c) Cost d) Sale price e) Number of items sold f) Profit Task 2: Write a function named readinput. (10 marles) a) It receives an array of Item of type atruct b) The function should read data from the given input text file named input.txt. The file contains itens codes and the member of items sold. Figure 1 shows an example of data that can be used to test the program c) Assuming you do not know, the number of items. Calculate the member of items sold based on the number of item records found in the input file. d) The function should return the mimber of items calculated in (). MIOL M101 12 1202 21 c303 15 74049 7404 27 c303 25 1202 16 M101 9 2 0303 26 1202 31 7404 13 M101 c303 30 1202 33 Figure 1: Sample data in the input file "input.txt" Task 3: Write a function named calculateSalePrice (10.5 marles) a) This is a non-retuming 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 determine the items' names and cost based on the information given in Table 1. 2 Code M101 B.202 Csos F404 Table 1 Name Double Mushroom Double BBQ Beet Grilled Chicken Fish'n Crisp Cost (RM) 113 TOLO 125 15.0 d) The function should also calculate the sale price for each item by adding 30% (markup percentage) to the cost of the item Example, if an item costs RM50 to produce, and you want to apply a mark-up of 25%, you need to multiply 50 by 1.25. The sale price would be RM62.50. Task 4: Write a function named displayOutput (10.5 marks) a) This is a non-retuming function. b) It takes an array of Iten of type struct and the number of items calculated in Task 2 as input parameters c) The fimction should display items" code, name, cost, sale price, member of items sold, and profit. The formula for calculating item profit is as follows: Isen 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 ITEX SUJE COSTRO SALE (OL) QUANTITY TROTSTRO 41.40 11.30 10.20 7.00 14.95 13.26 9.10 8.12 9.10 31.50 16.80 50.62 52.50 27 25 101 Double Mishra 202 Double MQ Dent C303 Grilled chicken 404 Pah "n # # 7404 Tian Cri Cas Grilled Chicken 202 Double TQ Dent 101 Double Mushroom X101 Double Mushroom caos Grilled Chicken 6202 Double 10 Det 7404 Tish'n Crisp 101 Double Minhen c303 Grilled Chicken 6202 Double 10 Det 14.95 31.03 7.00 10.20 11.30 11.30 7.00 10.20 14 26 9.10 13.26 8.12 54.60 94.00 11.30 7.00 10.20 9.10 31.05 79.00 100.0 Figure 2: Expected output for Task 4 Task 5: Write a function named displayAnalysis (17 marks) a) This is a non-retuming 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' names and total profit for each item. 3 input - Notepad File Edit Format View Help M101 12 B202 21 C303 15 F404 9 F404 27 C303 25 B202 16 M101 9 M101 14 C303 26 B202 31 F404 13 M101 9 9 C303 38 B202 33

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions