undefined

Bonus task | Lesson 11 | Level 9

Java Core
Level 9 , Lesson 11
Available

"Hello, Amigo! Enough messing around! Here are your tasks. They are going to be more difficult than the previous ones, and they'll be sure to improve your processor. And that's certainly something we need. If you run into difficulties, check with your colleagues. They'll definitely help."

"You did everything already? Well, here are some exercises that are even more difficult:"

undefined
20
Task
Java Core, level 9, lesson 11
Locked
Tracking changes
Read 2 file names from the console: file1 and file2. Both files contain text, but file2 is an updated version of file1. Some of the lines are still the same. You need to create a merged version of the lines by writing them to the lines list. The ADDED and REMOVED labels can't be used consecutively—t
undefined
20
Task
Java Core, level 9, lesson 11
Locked
Your own FileWriter
Implement FileConsoleWriter's logic. The FileConsoleWriter class must have a private FileWriter field called fileWriter. The FileConsoleWriter class must have every constructor used to initialize fileWriter for writing. The FileConsoleWriter class must have five write methods and one close method: -
undefined
20
Task
Java Core, level 9, lesson 11
Locked
Introducing tags
Read from the console the name of a file containing HTML. Example: Info about Leela Leela Turanga Supergirl The main method's first parameter is a tag name. For example, "span". Display all tags that match the speci
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Calculating salaries
The first parameter of the main method is a file name. Each line of the specified file has the following format: name value where [name] is a String and [value] is a double. [name] and [value] are separated by a space. Find the sum of all the values for each name. Display all the data, sorted by na
undefined
12
Task
Java Core, level 9, lesson 11
Locked
The richest
The first parameter of the main method is a file name. Each line of the specified file has the following format: name value where [name] is a String and [value] is a double. [name] and [value] are separated by a space. Find the sum of all the values for each name. Display in alphabetical order the
undefined
20
Task
Java Core, level 9, lesson 11
Locked
John Johnson
The first parameter of the main method is a file name. Each line of the specified file has the following format: name month day year where [name] is a String that can contain several words separated by spaces. [month] is an int, [day] is an int, and [year] is an int. The data is separated by spaces.
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Searching for the right lines
Read a file name from the console. Display all of the file's lines that contain only 2 words in the words list. Close the streams. Example: words contains the words A, B, and C Lines: C B A D // 3 words from words, rejected A B A D // 3 words from words, rejected D A D // 1 word from words, rejecte
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Words with numbers
The main method's first parameter is file1 and the second is file2. file1 contains lines with words separated by spaces. Write to file2 all the words that contain numbers, for example, a1 or abc3d. Separate the words with spaces. Close the streams.
undefined
20
Task
Java Core, level 9, lesson 11
Locked
Replacing numbers
1. In a static block, initialize map with (number, word) pairs from 0 to 12 inclusive. For example, (0, "zero"), (1, "one"), (2, "two") 2. Read the file name from the console, and then read the contents of the file. 3. Use map to replace all of the numbers with words. 4. Display the result. 5. Close
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Long words
The main method's first parameter is file1 and the second is file2. file1 contains words separated by spaces. Write to file2 a comma-separated list of words longer than 6 characters. file2 should not end with a comma. Close the streams. Example output to file2: lengthy,shortened,abbreviation
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Mirror image
1. Read a file name from the console. Read the contents of the file. 2. For each line in the file: 2.1. reverse the order of all characters. 2.2. display the result. 3. Close the streams. Example input file: I'm a programmer. Amigo Example result: .remmargorp a m'I ogimA
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Contextual advertising
Replace the System.out object in the main method with your own reader wrapper. Your reader wrapper should display a contextual ad after every other call to println. Call testString's existing printSomething() method. Restore the System.out variable back to the original stream. Ad text: "CodeGym - o
undefined
12
Task
Java Core, level 9, lesson 11
Locked
Correct the bug. Classes and interfaces
This program has just 1 logical error. Find and fix it.
Comments (35)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Andrei Level 25
22 February 2021
Man, it took me I think about 3 weeks to finish this level, with almost half of that time spent on these tasks. It's done, yay!
Chandan Thapa Level 22 Dubai United Arab Emirates
18 January 2021
the hardest task so far in my codegym journey was tracking changes.. but wait that wasn't enough, Introducing tags took that place. Spent days on these two tasks. But learned a lot in the process, . :) Glad!
Seferi Level 22 United Federation of Planets
19 November 2020
I took the easy way out for the task 'introducing tags' and used Jsoup..
Davedabull Level 22 New York City United States
14 October 2020
If you passed the question example but still can't pass all the requirements, try this example.
Agent Smith Level 38
12 September 2020
Introducing tags task has been completed by 163 students. Numbers are getting lower!
Blaise Level 20 London United Kingdom
8 July 2020
Some hints. Words with numbers (task1923): "Words" in this task can contain non-word characters, not just numbers, so make sure you check for every possible character, except "space", as "space" is used as word separator. Replacing numbers (task1924): I can confirm that you can pass this as suggested by Ivan Duka a bit down below in the comments. Thanks, Ivan. Passed it first try and did not try any other ways to solve it, already wasted too much time pleasing the validator with other tasks :( In case you use the "String.split()" method, you can print out the modified sentence with a for loop. No need to remove the last space after the last word:

// print line
for(String s: words) {
    System.out.print(s + " ");
}
System.out.println();
Good luck.
MaGaby2280 Level 30 Guatemala City Guatemala
21 April 2020
Last one is sssoooo hard! Took me a week to get it done! Happy to move on!
Fadi Alsaidi Level 27 Carrollton TX USA
13 April 2020
I seriously wanted to rip my monitor apart for the <tracking changes task>. However, once it cleared, I was so happy.
Justin Johnson Level 31 Clearwater United States
23 February 2020
A couple of those tasks were pretty difficult. Very fun to solve.
Diana Salvador Level 26 Sintra Portugal
17 February 2020
Regarding the "Introducing tags" task, it is very important to debug the code! Perform a lot of testing with different nasted tags, eventually your code will show the correct output for all of the examples! Don't give up, you can do it :)