You work at asoft drink distributorshipthat sells at most 100 different kinds of soft drinks. The program youwrite for this assignment will process weeklytransactionsand allow fora report to bedisplayed that includes the soft- drink name, ID, starting inventory, final inventory, andthe number of transactions received.
There are two data files, data6.txt and data6trans.txt,which hold the initial soft drink information and transactions, respectively.The file data6.txt consists ofat most100 lineswhere each line contains thesoft drink name (one string), ID (string), and thestarting inventory of cases(int).
The file data6trans.txt holds the transactions. Each transactionconsists of the ID followed by the number of cases purchased (positive integer), or the amount sold (negative integer). Youcan assume the format of the data is correct, but not all IDs arevalid. In the case of an invalidID, do not process thedata (ignore it, no error message).
Sample data6.txt: Sample data6trans.txt:
Coke |
123 |
100 |
345 |
10 |
Pepsi |
345 |
50 |
123 |
-5 |
CanadaDry |
678 |
75 |
345 |
10 |
DrPepper |
444 |
120 |
678 |
8 |
|
444 |
20 |
||
444 |
-20 |
|||
444 |
10 |
|||
999 |
5 |
|||
345 |
10 |
|||
123 |
-25 |
The displayReport functiondisplays the drink name, ID, starting inventory, final inventory, andthe number of transactionsprocessed. Display this exact format (numberof blanks separating items does not have to be identical).
For the sample data,the output of your program would be as follows:
Soft Drink ID Starting Inventory Final Inventory # transaction
Coke 123 100 70 2
Pepsi 345 50 80 3
CanadaDry 678 75 83 1
DrPepper 444 120 130 3
Write a SoftDrinkInventoryclasswith the following functionality:
public constructor: Initializes arr