CrUD for a table inside a file
Read a file name for CrUD operations from the console
The program runs with one of the following sets of arguments:
-u id productName price quantity
-d id
Argument values:
where id is 8 characters
productName is 30 characters
price is 8 characters
quantity is 4 charact
Prices 2
- 20
Locked
Comments (12)
- Popular
- New
- Old
You must be signed in to leave a comment
Олег БайбулаExpert
21 February, 08:20
I've put everything in try-with-resources, but i can'tpass last requirment. 😕
0
Mike S
16 February, 21:04
Holy smokes. Finished this one in about 1/15th of the time it took for me to do its younger brother, "Prices". No tricks here. Just rewrite the file, but modify appropriately when the id matches the one in the arguments. (Hint: a simple delete technique can be achieved by writing the 'new' string as "").
0
Nyarlathotep
28 January 2022, 16:45
My file works but couldn't pass verification. Even the solution given doesn't pass the verification though. Is there some issue?
+2
Łukasz Krawiec
2 February 2022, 15:14
So, mine works too, does exactly what asked and it fails.
And it's the same with the solution.
They need to fix it :)
0
Roman
9 February 2022, 07:25
Nyarlathotep, ReHaToE
Please post your question with the attached solution in the section Help. And give me a link
0
Sansho
2 July 2021, 14:21
Warning when you use this:
Consider that this line clear your file BEFORE you write on it. So save/interact with your datas in your code before you create it ;)
i.e.:
With this:
Your code will works with an empty "filename.file" +4
Nyerges Ferenc
8 November 2020, 18:40
Done 1st time :-) yee-ha. That was tricky :-)
+2
Switch/Cypher
9 October 2020, 10:37
Yup, hard. But totally doable, and I started this course with absolutely zero knowledge of coding in any way. Took about 4/5 hours. Learnt a lot about Regex.
I think 269 had passed when I passed it.
+1
Agent Smith
6 September 2020, 14:48
Only 252 people managed to do this task as of 6 September 2020.
+2
Sansho
2 July 2021, 14:15
Only 435 today
(A bit more than 700 for the Prices 1)
0
matemate123
26 January, 21:12
Agent, I'm report that is 557 now!
0
Radek
18 November 2018, 22:33
Taking into consideration possible number of variants to find the one expected by validator, this task seems to be rather time consuming, so a little clarification would be appreciated to the conditions.
1. What form should the remaining data have after deletion of one line? Should we apply "Each data field is padded with spaces up to its length" in this case or not?
2. Requirements poin3 - the product information in the file should be updated. - should "Each data field is padded with spaces up to its length" be applied to all products in file or only to updated one ?
3. How the solution should behave if input file does not contain the product with id provided in args[1]?
Only situation for empty args[] is clear.
+4