Question: you need to develop a complete C ++ program by applying data structures and file processing methods to extract all input data from a text

you need to develop a complete C ++ program by applying data structures and file processing methods to extract all input data from a text file, process that data and generate a single output file.

The data inputs are listed as inTable 1, which consists of two columns; product code and quantity sold.

The program must use various types of structured data as follow;

code

name

cost

sale price

number_of_items_sold

profit

Table 1 : Input data

M101 16

B202 21

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

M101 12

B202 21

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

M101 12

B202 21

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

C303 18

M101 9

M101 14

C303 26

C303 18

F404 9

F404 27

C303 25

B202 16

M101 9

M101 14

C303 26

F404 27

C303 25

B202 16

M101 9

C303 18

M101 9

M101 14

C303 26

C303 18

F404 9

F404 27

C303 25

There are only 4 different codes with each code having a different cost. In your program, it should determine the name and cost of the item based on the information given inTable 2.

Table 2 : Items' name and cost (RM)

Code Name Cost (RM)
M101 Double Mushroom 11.50
B202 Double BBQ Beef 10.00
C303 Grilled Chicken 12.50
F404 Fish and Crisp 15.00

The example of output file format shown inFigure 1and the detils for each colum are as follow;

NO = number of data row, start counting from 1 until end of data input

CODE = item code for each row

PRODUCT = the product name each row (See Table 2)

UNIT = the number of item sold for each row

COST= the cost for each row (See Table 2)

PRICE = sale price = COST x 1.30

T.PROFT = Total Profit = (PRICE - COST) x UNIT

T.SALES = PRICE x UNIT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!