Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please Help me!! needed it within 40 minutes! urgent Write a complete C++ program The program uses various types of structured data developed to calculate

please Help me!!

needed it within 40 minutes! urgent

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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 d) The function should also calculate and display the total amount of profit for all items and the highest profit. e) Figure 3 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. TOTAL PROTT ISTIK AG Double Minhen Double ng test Grilled Chicken Tiah's Crisp 309.06 210.40 The total amount of protit - RM 527.46 Itighest prost - 309.06 Item Figure 3: Expected output for Task 5 Task 6: Write a main function to perform the following tasks: (5 maris) a) Declare one-dimensional anray variable with 50 elements for a structure type b) The fiunction may need to call the functions that are defined in the previous task to produce the output as shown in Figure 4. Note: Please 15e proper output formatting c) Figure 4 shows the complete output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. SALE(TM) QUANTITY FR7 [ENG 9.10 8.12 21 15 31.50 16.00 9.10 92.50 16 14 CODE ITEM MANGE COAT(736 01 Debte Mehr 11.50 1202 Double Dent 10.20 c303 Gestled Chicken 7.00 TI TI "P THE 7404 Tish's Crap c303 Geslled Chicken 7.00 1202 Double Dent 10.20 01 Debte Mehr 11.50 Xo1 Date Mushroom 11.50 c303 Geslled Chicken 7.00 202 Doble Test 10.30 T404 Tishin sap Xol Double shoes 11.50 c303 Geslled Chicken 7.00 1202 Doble ng font 10.20 TTER SA Double Mushroom Double Dest Grilled Chicken Tash'n Crap 14.95 9.10 31.05 40.30 34.60 31 13 9.10 31.05 79.00 100.00 TEA: FPTIT (TM 151.00 309.06 210.40 91.80 The total cost of protit - RX 527.46 Highmat Tut it PM 13%. g Figure 4: Complete output for the data from the input file "input.txt" 4 Task 7: Listall function prototypes (4 marks) 6 marts) Task 8: You must ensure your program fulfill the following criteria: a) The program is able to run. b) All required header files are included 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 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 d) The function should also calculate and display the total amount of profit for all items and the highest profit. e) Figure 3 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. TOTAL PROTT ISTIK AG Double Minhen Double ng test Grilled Chicken Tiah's Crisp 309.06 210.40 The total amount of protit - RM 527.46 Itighest prost - 309.06 Item Figure 3: Expected output for Task 5 Task 6: Write a main function to perform the following tasks: (5 maris) a) Declare one-dimensional anray variable with 50 elements for a structure type b) The fiunction may need to call the functions that are defined in the previous task to produce the output as shown in Figure 4. Note: Please 15e proper output formatting c) Figure 4 shows the complete output that will be displayed on the screen based on the data in the input file "input.txt" shown in Figure 1. SALE(TM) QUANTITY FR7 [ENG 9.10 8.12 21 15 31.50 16.00 9.10 92.50 16 14 CODE ITEM MANGE COAT(736 01 Debte Mehr 11.50 1202 Double Dent 10.20 c303 Gestled Chicken 7.00 TI TI "P THE 7404 Tish's Crap c303 Geslled Chicken 7.00 1202 Double Dent 10.20 01 Debte Mehr 11.50 Xo1 Date Mushroom 11.50 c303 Geslled Chicken 7.00 202 Doble Test 10.30 T404 Tishin sap Xol Double shoes 11.50 c303 Geslled Chicken 7.00 1202 Doble ng font 10.20 TTER SA Double Mushroom Double Dest Grilled Chicken Tash'n Crap 14.95 9.10 31.05 40.30 34.60 31 13 9.10 31.05 79.00 100.00 TEA: FPTIT (TM 151.00 309.06 210.40 91.80 The total cost of protit - RX 527.46 Highmat Tut it PM 13%. g Figure 4: Complete output for the data from the input file "input.txt" 4 Task 7: Listall function prototypes (4 marks) 6 marts) Task 8: You must ensure your program fulfill the following criteria: a) The program is able to run. b) All required header files are included 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

Database And Expert Systems Applications Dexa 2021 Workshops Biokdd Iwcfs Mlkgraphs Al Cares Protime Alsys 2021 Virtual Event September 27 30 2021 Proceedings

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Atif Mashkoor ,Johannes Sametinger ,Anna Fensel ,Jorge Martinez-Gil ,Lukas Fischer

1st Edition

3030871002, 978-3030871000

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago