undefined

Tasks | Level 5 | Lesson 2

Java Core
Level 5 , Lesson 2
Available

"Yesterday, robbers broke into my house, turned everything upside down, and sifted through the whole house, looking for money."

"That's horrible, Diego. What did you do?"

"Nothing. I started laughing with them and joined them in the search for money. Ha-ha."

"Since my house is a total mess, I couldn't find your task. I'll have to wing it. Here you go."

undefined
4
Task
Java Core, level 5, lesson 2
Locked
OOP: Arrange interfaces
Clothing can (and should, perhaps) be worn, sold, and bought, preferably at a discount. Let's tell the world. We'll add the Movable, Sellable, and Discountable interfaces to the Clothes class, if possible. And then we'll implement their methods (big surprise!).
undefined
4
Task
Java Core, level 5, lesson 2
Locked
OOP: Animal inheritance
Next to a mouse, even a goose is enormous. But next to a dragon... In this task, we have geese (Goose class) and dragons (Dragon class). As well as their ancestors, BigAnimal and SmallAnimal classes. Guess for yourself whose ancestor is whose. Then override the String getSize() method for Goose and Dragon so that they display strings about the animal's size.
undefined
8
Task
Java Core, level 5, lesson 2
Locked
OOP: Cars
Let's categorize cars. Create classes for affordable and expensive cars, and then make the Ferrari and GeoMetro classes inherit them as you see fit (but please note that the CodeGym code validator has a definite opinion on the matter). We'll implement printlnDesire methods in these classes that will tell us the secret desires of their drivers.
undefined
16
Task
Java Core, level 5, lesson 2
Locked
OOP: Books
In this task, we will create books written by the earthly authors Mark Twain and Agatha Christie. Using the MarkTwainBook and AgathaChristieBook classes, naturally, which inherit Book. You need to implement all the abstract methods in these classes. And in the parent class, implement the getOutputByBookType method.
undefined
8
Task
Java Core, level 5, lesson 2
Locked
OOP: Fix inheritance problems
Let's investigate some body parts. First, we'll check whether bones are present. You need to fix the containsBones method and all associated logic so that, without changing the program's behavior, it returns an Object: "Yes" instead of true, and "No" instead of false.
Comments (37)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Karas Level 19 Tampa United States
22 February 2021
Is anyone scraping for dark matter? and no more easy tasks to do? well... to the games area we go...
Oliver Heintz Level 18 Mustang United States
10 January 2021
Everyone seems to talk about that last task, which I thought was very straight forward. I must have finished it in less than 10 minutes from first looking at it. I got stuck for hours on the Books task, though, and no one in the comments seemed to think that was tough.
Andrei Level 25
4 December 2020
I am going to be dreaming Bones, Fingers and BodyParts tonight.. haha.. the last one took me maybe 1 hour or more? Sheeeesshhh... On to the next one!
Chandan Thapa Level 22 Dubai United Arab Emirates
2 December 2020
had a tough time on the last one.. but worth it!
Brad Reed Level 19 Hartford United States
23 July 2020
That verifier is VERY picky sometimes....
Jeanine Kimball Level 26 New London United States
14 July 2020
I was definitely overthinking that last task. Took me longer than it should have, and initially made me doubt myself.
Angel Li Level 18 Fremont United States
6 July 2020
For these tasks I have used the keyword
 this 
a lot. I'm always very sure of what
 this 
is pointing to. Could anyone clarify?
Manish Sinha Level 26 london United Kingdom
11 April 2020
for last task , I believe hint should be given I feel. Hint: Every String is an Object but Object is not a String.(LOL) Last task took me 90 mins to solve it.Happy , I got through. meanwhile I learnt few things which is even more precious than the task itself. now I realise , why tasks are good way to learn the java(say any programming language). thanks codegym for providing us with this awesome ways to learn java.
Sanjay Chauhan Level 28 Delhi India
7 March 2020
OOP: Books is the best task. Don't skip it.
Nyerges Ferenc Level 23 Bükkábrány Hungary
23 January 2020
Passed each for first attempt - thanks to the well-explained foundations :-)