undefined

Final tasks

Java Syntax
Level 8 , Lesson 11
Available

"Hello, soldier!"

"Hello, Captain Squirrels, sir!"

"I have great news for you. Here are some exercises to reinforce your skills. Work on them every day, and your competence will grow exponentially. They were specially designed for IntelliJ IDEA."

"Those previous exercises were for rookies. I've added some more advanced bonus exercises for the old-timers. Just for veterans."

undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Set of cats
You need to create a set of cats. This requires a public static Cat class. Then implement the createCats method, which should create a Set of cats and add 3 cats to it. In the main method, remove one cat from Set cats. Finally, implement the printCats method. It should display all the cats that remain in the set.
undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Animal set
Let's add animals to sets. First, we'll create Cat and Dog classes and then createCats and createDogs methods, which will return sets with dogs and cats. We'll write a join method that returns the union of the dog and cat sets. To handle any unfriendliness, we'll create the removeCats method, which removes cats from pets. And finally — the printPets method, which displays everything in pets.
undefined
2
Task
Java Syntax, level 8, lesson 11
Locked
Shared last names and first names
We're ready to discover our namesakes! We just need to write a program to realize this heartwarming goal. To start, let's create a Map, where we will add people represented by (last name, first name) pairs. Let there be ten of them, with some of them sharing last names and some of them sharing first names. After that, we'll display the contents of the Map on the screen.
undefined
5
Task
Java Syntax, level 8, lesson 11
Locked
Minimum of N numbers
The programmer searches for minima and maxima wherever he can—among two numbers, in an array, in a list... Students at the secret CodeGym center study lists on the eighth level, so this important moment has come for you. Even now, you can try to find the minimum in a list of n numbers. But before you look for the minimum, you need to create a list. What are you waiting for?
undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Going national
Once diners get over their initial reservations about the proper color of breakfast foods, they fall in love with green eggs and ham. Sam-I-Am has big plans to open a national chain of restaurants featuring his signature dish. He'll launch the Green Eggs and Ham restaurant chain as soon as he can find suppliers of properly colored eggs. We will write a program that replaces the text "green eggs and ham" with "Green Eggs And Ham".
undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Make a family
Let's try to create a program for a family census. To do this, we'll write a Human class with String name, boolean sex, int age, and ArrayList children fields. To practice, create objects and fill them with data so we end up with two grandparents, two grandmothers, a father, a mother, and three children. Display the objects on the screen.
undefined
2
Task
Java Syntax, level 8, lesson 11
Locked
Mixed-up modifier
Not everyone can be static! And if a static modifier ends up where it shouldn't be, anything could happen! This is exactly what happened in the code you'll see once you open this task: one static modifier ended up in the wrong place. Help the program compile by putting the modifier where it belongs! Thanks.
undefined
5
Task
Java Syntax, level 8, lesson 11
Locked
Five winners
Onboard the CodeGym spaceship, students in Levels 7-8 completed a multi-stage contest to see who could complete tasks the fastest. Among the 20 semi-finalists, the five with highest scores are winners. So, we have an array with the semi-finalists' scores (note that scores can be negative). We'll display the magnificent top five.
undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Working with dates
The Nebula-1 station receives spaceships only on odd days of the standard earth year (i.e. days when there have been an odd number of days since the beginning of the year). Let's find out if we can party on Nebula-1 today. To do this, we'll implement the isDateOdd(String date) method, which returns true if the number of days since the beginning of the year is odd, and otherwise returns false.
undefined
5
Task
Java Syntax, level 8, lesson 11
Locked
Month number
The time intervals "year" and "month", which have been adopted on Terra, are also used on other Federation planets and objects, including the CodeGym spaceship. But new extraterrestrial crew members are often confused by these earthly months. Let's help them: write a program that uses collections to display a number's month given its name.
undefined
10
Task
Java Syntax, level 8, lesson 11
Locked
Software update
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.
undefined
5
Task
Java Syntax, level 8, lesson 11
Locked
Task about algorithms
You probably already know the ordered isomorphs of Planet Linear Chaos, who like sorting algorithms because they use them to think. Here's a little task for isomorphs in elementary school: enter 20 words from the keyboard and display them in alphabetical order. But how do we sort them? Come up with the answer yourself! You're practically a linear isomorph!
Comments (55)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
DarthGizka Level 24, Wittenberg, Germany
30 May 2021
task0828 (Month number) caveat: one of the task requirements is 'The program must use collections.'. Simply creating a collection à la

new LinkedList<Solution>();
is not enough, however. I got the nonsense to pass by stuffing the calculated result into a LinkedList<Integer> and pulling it out in the println via getFirst(). These unstated nonsensical requirements are rather frustrating...
ImDevin Level 15, Old Town, United States
5 May 2021
these were not easy, but learned a lot (hope I can remember it all). I'm glad people take time to answer the posted questions. between googling and the comments, was able to solve all the tasks. On to level 9!! Happy coding! :)
John H Level 15, Charlotte, United States
14 April 2021
Animal set. It was given in the program code to call the printPets() method twice; however requirement 7 states, "The printPets() method should display all the animals in the set pets." The validator did not accept the version with both print calls, but did accept it once the second was removed. Tricky indeed, so got it in 2 tries.
John H Level 15, Charlotte, United States
13 April 2021
Set of cats. My code was correct for the printout required; however the validation failed on 3 counts. Evidently, it didn't want a field in the Cat class, nor in the default constructor. Once these were removed, it cleared 3 of the conditions flagged by the validator and passed. Hope this helps.
Jurij Thmsn Level 24, Flensburg, Germany
26 January 2021
This page took me longer than all pages before combined :D
The Chief Level 16, United States
29 December 2020
Some of these tasks require bubble sort. But it hasn't taught us bubble sort yet so how can it expect us to do those tasks?
Guanting Liu Level 14, Springfield, United States
16 November 2020
Don't check the "help" button if u wanna learn,let's go!
Agent Smith Level 38
18 August 2020
Great tasks, learned a great deal of new tricks.
Yug Level 16, Dehra Dun, India
8 August 2020
The questions were good. I needed help in some questions, but i was very close to the solution and hints helped me to solve them. Feeling good.
Yordan Popov Level 11, Asenovgrad, Bulgaria
5 August 2020
Umm.. i have a question.. I`m just copy-pasting from here and there and it works.. but is it really a good enough way to learn programming? (i`m not seeking for the best way, but a good enough!)