A parts company has information on its parts in a data file "parts.dat". The data in the data file is structured as follows:
The data file consists of 2 parts. The first part has information on the parts. Each line of data contains the part number ( an integer), a description of the part, the quantity in stock and the unit price separated by one or more spaces. The description of the part is contained within two '*' ( the asterisks are not part of the description). This section of data is terminated by a line with a single 0.
The next half of the data file consists of transactions performed on the data. Each line consists of two letters indicating the transaction to be performed and this is followed by data relevant for the transaction. The different kinds of transactions are as follows:
1. To add a new part:
ap partNumber *description* quantityInStock unitPrice
2. To sell a part:
sp partNumber quantitySold
3. To change the price of a part:
cp partNumber newPrice
4. To add stock of a particular part:
cq partNumber quantityToAdd
5. To list all information on all parts:
ls
Your program must store the part information using appropriate structures in ascending order by the part id number.
Your program must cater for cases where there is not enough quantity in stock for sale, or the part number does not exist. In these cases, appropriate error messages must be printed.
Your program must also print after processing all the transactions the total sales figure.
An example of the format of the data file is given below.
2345 *Stanley Bearing* 178 12.56
3456 *Silver Rims* 4 500.00
7862 *Castrol GTX 50 Body Engine Oil* 29 20
0
ap 9872 *BrakeShoes* 50 2241.00
ls
sp 2345 58
sp 7862 15
cq 2345 100
cp 7862 19.59
ls
ANY ONE WANT TO HELP ME ??MY CODE HAS ALOT OF ERRORS HOW TO DO IT?