Bonus task | Lesson 11 | Level 9

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

10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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.
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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.
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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:"

10
Task
Java Core,  level 9,  lesson 11
unavailable
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
10
Task
Java Core,  level 9,  lesson 11
unavailable
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: -
10
Task
Java Core,  level 9,  lesson 11
unavailable
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(13)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Daniel TinsleyLevel 19 , United States
day before yesterday, 06:46
Yet another wall of problems that is going to take me days to complete lol.
CarlosLevel 22 , Leon
24 September, 16:25
all I can say is that instructions for these past tasks have huge room for improvement. I've completed all of the tasks in here successfully and there's a lot to mention. If anyone hits this place and I'm still around, feel free to contact me in case you need any help ;)
Ivaylo TrifonovLevel 20 , Madrid
24 October, 18:41
I totally agree with You about the instructions and requierments.
SennedLevel 33 , Azov
16 September, 13:53
For "Tracking changes" be sure that you right writing ends of files to list (the files can have different numbers of strings).
EwertonLevel 30 , Belo Horizonte
5 July, 21:17
The most frustrating thing here is when your program works 100%, you test it with many variations, and the interface just tells you that your file sucks and refuse to accept it.
Ivaylo TrifonovLevel 20 , Madrid
24 October, 18:39
I passed through this... :(
Ivan DukaLevel 22 , Winnipeg
23 April, 00:20
Attention "Replacing numbers"! In order to pass it, you need to check ONLY for numbers that have spaces before and after them. It means that you should split the line by " " and that's it. I almost went mad with it, created an elaborate and complex regex but still couldn't pass the tests! P.S. It means that the example given is WRONG (I mean the number and dot immediately after is not counted as number, only when there is a space before and after the number).
AbrahamLevel 20 , Watsonville
30 July, 10:29
Thanks for this. I was going mad as well, creating an elaborate punctuation check then adding it to the end of the string if and only if the substring of that number string was a number. The code was looking horrific. Cheers!
nullLevel 27 , Poznan
23 August, 11:17
Thanks, It was very important.
Ivan DukaLevel 22 , Winnipeg
22 April, 23:15
A hint for "Words with numbers" - you need to print all words with numbers on one line of File2
Ivan DukaLevel 22 , Winnipeg
22 April, 17:49
A hint for "Introducing Tags": use regex, but do not look for matches, find start and opening tags' indexes. Good luck!
季军Level 29 , Shanghai
3 August, 15:01
Could you tell me how to use regex to identify nested tags? I passed this using a stack, but i don't know how to achieve similar effect using just regex, thanks.
Ivan DukaLevel 22 , Winnipeg
22 April, 13:30
Hints for "Tracking changes": when faced with the logic that requires you to look ahead in data, do not attempt to solve it by reading line-by-line. Read everything into arrays and then play with them. Also, it helps to print those arrays in the process of figuring out the algorithm (i.e. print the partially processed arrays). Finally, do not forget that operations on empty arrays can (and will) lead to errors and you always need to provide logic for it. Good luck!