Software update

  • 10
  • Locked
You've probably seen how applications are updated. This happens if changes are made to their code. At the secret CodeGym center, you've been given code that needs to be changed (you need to add new functionality). The program currently determines which family lives in the house with the specified number. After your intervention, it should output the family's city of residence.
You can't complete this task, because you're not signed in.
Comments (15)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Andrew Evans
Level 17 , San Jose, Canada
15 February 2022, 14:54
Can be done using iterator and .next() in the print statement
Level 16 , Jacksonville, United States
23 January 2022, 07:24
Ok so again I had to look at the answer to even begin to understand the question. Here's what you need to know if you don't want to do that just yet yourself. the goal is such The input list contains a city followed by a family name aka Chicago - Capone, New York - Rockefeller, Seattle - Gates. This was not clear you take 6 linked pieces of information in the order they give and you make a collection out them. then once you get to the break line - line 7 of the input you stop collecting. next you display the information linked to the item they give you in input line 8. and that is how you solve this. the trick is some of the code they give you already is usable and a lot has to be modified to your chosen collection. I hope whoever reads these comments from CodeGym redoubles their effor to make these examples more clear in terms of both what is being asked and what is being given.
carlos oliveira
Level 10 , Seattle, United States
13 December 2021, 06:03
I really don't understand this task meaning , e.g create a HashMap to deal with only one object. where to use this approach, instead the task should create a HashSet , a address class and wrap it inside the HashSet and them sort the family by city , so the Set implementation would be loadded with as many address you want.
Level 10 , Forest Grove, United States
5 May 2021, 22:06
Hint if you're stuck (spoiler): Add a HashMap. /*if your input .isEmpty then break loop, otherwise add to HashMap*/, Finally search your HashMap for a match and print :)
Level 15 , Old Town, United States
5 May 2021, 14:36
like Florin1 said, the input example shows city, then family, in that pattern. Didn't realize that for a while, but afterwards, made sense to use HashMap with its key-value. Also, it was cool to know you don't have to loop to print (although, realized after already looping it). Happy coding! :)
Samuel Michael
Level 16 , Stafford, United States
6 January 2021, 05:23
A pattern to the input Name of person = name of city + 1 Using an Arraylist, you can use a for loop to display the value of (i+1) for whatever value of (i) entered
ayhem bouabid
Level 25 , Tunis, Tunisia
7 January 2021, 10:22
I think it would be better to use the method indexof() of the ArrayList class instead of a loop.
Lucas Hoage
Level 14 , Savannah, United States
4 June 2020, 02:29
If you're using hashmaps, entries can be null in this particular exercise. So if you use a break statement after an empty condition, the first field will be null and the second field would be null. It will still work on your output. No condition is needed when checking the keys. you can pass the arguments in the sysout parameters.
Level 31 , Romania
22 March 2020, 14:14
Hint: Example input area gives city and, on the next line, the family name.
Devonte A
Level 18 , Rubery, United Kingdom
21 March 2021, 14:57
Thanks for that..I dont know why they didnt make that clearer!
Letenyei Ádám
Level 16 , Bakonyszombathely, Magyarország
23 July 2019, 11:19
Nullpointer exception on 26.line. Why? Please help
Level 41
24 July 2019, 05:27
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at
Rakesh Kumar
Level 16 , Gambat, Pakistan
2 July 2019, 15:05
can i get an explanation on the question