Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions