Prices 2

  • 20
  • Locked
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
You can't complete this task, because you're not signed in.
Comments (12)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Олег Байбула
Level 32 , Ukraine
Expert
21 February, 08:20
I've put everything in try-with-resources, but i can'tpass last requirment. 😕
Mike S
Level 28 , Saint Louis, United States
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 "").
Nyarlathotep
Level 34
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?
Łukasz Krawiec
Level 30 , Netherlands
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 :)
Roman
Level 41
9 February 2022, 07:25
Nyarlathotep, ReHaToE Please post your question with the attached solution in the section Help. And give me a link
Sansho
Level 19 , Bordeaux, France
2 July 2021, 14:21
Warning when you use this:
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filename));
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:
BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(filename));
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(filename));
[your code]
Your code will works with an empty "filename.file"
Nyerges Ferenc
Level 23 , Bükkábrány, Hungary
8 November 2020, 18:40
Done 1st time :-) yee-ha. That was tricky :-)
Switch/Cypher
Level 25 , Bexleyheath, United Kingdom
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.
Agent Smith
Level 38
6 September 2020, 14:48
Only 252 people managed to do this task as of 6 September 2020.
Sansho
Level 19 , Bordeaux, France
2 July 2021, 14:15
Only 435 today (A bit more than 700 for the Prices 1)
matemate123
Level 37 , Kraków, Poland
26 January, 21:12
Agent, I'm report that is 557 now!
Radek
Level 22 , Warsaw, Poland
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.