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 (6)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
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)
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.