Bonus task | Lesson 11 | Level 9

Level 9, Lesson 11

"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."

12
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
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
20
Task
Java Core,  level 9lesson 11
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.
12
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
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.
20
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
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
12
Task
Java Core,  level 9lesson 11
Correct the bug. Classes and interfaces
This program has just 1 logical error. Find and fix it.

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

20
Task
Java Core,  level 9lesson 11
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
20
Task
Java Core,  level 9lesson 11
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: -
20
Task
Java Core,  level 9lesson 11
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
Comments (32)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Chandan Thapa Level 20, Dubai, United Arab Emirates
18 January, 17:49
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, 16:47
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, 21:23
If you passed the question example but still can't pass all the requirements, try this example.
Agent Smith Level 38, Latvia
12 September 2020, 17:44
Introducing tags task has been completed by 163 students. Numbers are getting lower!
AlfredW Level 22, Denver, United States
23 October 2020, 21:53
Where do you see that? How do you tell how many people have finished the task?
Agent Smith Level 38, Latvia
24 October 2020, 10:42
You can see stats when you complete exercises in IntelliJ.
AlfredW Level 22, Denver, United States
26 October 2020, 21:56
I can't seem to find them. Looking all over the place.
Seferi Level 22, United Federation of Planets
19 November 2020, 16:48
Easy way for that task is Jsoup..
Chandan Thapa Level 20, Dubai, United Arab Emirates
18 January, 17:52
And now after 4 months.. only 59 more students added to that list including me ;).. the number is 222 students
Blaise Level 20, London, United Kingdom
8 July 2020, 16:35
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 28, Guatemala City, Guatemala
21 April 2020, 22:23
Last one is sssoooo hard! Took me a week to get it done! Happy to move on!
Fadi Alsaidi Level 25, Carrollton, TX, USA
13 April 2020, 01:53
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, 21:41
A couple of those tasks were pretty difficult. Very fun to solve.
Diana Salvador Level 26, Sintra, Portugal
17 February 2020, 17:19
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 :)
Seb Level 41, Crefeld, Germany
5 January 2020, 19:18
Wow, another set of great tasks! Especially the last one (introducing tags) can be a little challenging though. Probably a good idea to think about the logic first - maybe even put it on a piece of paper - and only then start to code... Good luck!