CrUD for a table inside a file.
Read a file name for CrUD operations from the console.
The program is started with the following arguments:
-c productName price quantity
Argument values:
where id is 8 characters.
productName is 30 characters.
price is 8 characters.
quantity is 4 characters.
-c adds the product with the specified parameters to the end of the file, and generates an id by incrementing the maximum id found in the file.
The file data is stored in the following order (without separating spaces):
id productName price quantity
Each data field is padded with spaces up to its length.
Before adding a new line, re-write all of its contents to the file.
Example:
19847 Swim trunks, blue 159.00 12
198479 Swim trunks, black with printe173.00 17
19847983Snowboard jacket with reflecti10173.991234
- The program should read a file name for CrUD operations from the console.
- The Solution class should not use static variables.
- When you run the program without arguments, the product list must remain unchanged.
- When the program is run with the arguments "-c productName price quantity", a new line with the corresponding product should be added to the end of the file.
- The product must have the next id after the maximum id found in the file.
- The format of the new product line must precisely match that format specified in the task.
- The file streams must be closed.