Same Questiion But I Do Not Know How To Do It In Linked List.
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 USE A LINKED STRUCTURE THAT MAINTAINS THE LIST IN SORTED ORDER BY PART NUMBER .
YOUR PROGRAM MUST CATER FOR CASES WHERE THERE IS NOT ENOUGH QUANTITY IN STOCK FOR A 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
I GOT ALOT OF TROUBLE WITH STRUCTURES JUST A WEEK AGO NOW HOW THE HECK DO I DO THIS ONE?IS IT POSSIBLE TO MODIFY MY STRUCTURE PROGRAM TO A LKINK LIST ONE? HELP