undefined

Interface tasks | Level 3

Java Core
Level 3 , Lesson 2
Available

"Hello, Amigo! I've got great news for you! Tonight, you will definitely be in a good mood."

"Oh, why?"

"Yes. Because you're going to interfaces so well. Ha-ha-ha! Here are ten(!) tasks for you. Don't be bored, Amigo!"

undefined
3
Task
Java Core, level 3, lesson 2
Locked
Beer
There's no such thing as too much programming... But "too much beer" can result in "it's time to go home" or "sleep on the floor". In this task, you will get two interfaces. The BeerLover class needs to implement one of them. At the same time, you need to understand the relationship between the READY_TO_GO_HOME variable and the isReadyToGoHome method.
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Beer. Part 2. The recovery.
Beer can be both alcoholic and nonalcoholic. The difference is huge. But no matter what type of beer you have, it is the process of drinking that unites man with beer. In this task, we will only drink alcoholic beer. Enable the Drink interface in the AlcoholicBeer class and implement all of its methods.
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Don't mix beer with cola
Do you prefer beer or cola? Perhaps it depends on your mood? Either way, the most logical interface between humans and beer or between humans and cola can be expressed in a single word: "drink". Implement the Drink interface in the Beer and Cola classes.
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Selectable and Updatable
Galaxy Rush's engineering department decided to set up a surveillance system for Planet Wild Robots. Your task is simple: make a Screen class that implements the Selectable and Updatable interfaces.
undefined
8
Task
Java Core, level 3, lesson 2
Locked
Four mistakes
Once again you're working on someone else's code, and once again you have to fix their mistakes. You'll need to gradually get used to this process. Luckily, this time, it's a very simple task about interfaces, with only 33 lines of code. So, no whining, just get going and fix the bugs. Hint: There are only four bugs.
undefined
8
Task
Java Core, level 3, lesson 2
Locked
Buggy initializeIdAndName
Something's wrong with this code! Your task is to fix the program so that it compiles and runs. First, figure out why it isn't working and then implement the initializeIdAndName method in the User class. In this case, the User class's initializeIdAndName method must return a User.
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Parameterized interface
Remember generics? They are generalizations - parametrized types, right? If not, rack your brain, then search through the lessons, and then search Google. Or use a different order if you'd like. Then, look at this task's code and make the StringObject class implement the SimpleObject interface using a String parameter.
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Hey, are you alive?
The program you are going to write should answer this question. To accomplish this, create a Person interface and add an isAlive() method, which will return whether the Person object is alive. Can you guess which type this method should return?
undefined
3
Task
Java Core, level 3, lesson 2
Locked
All that moves
We are going to create an interface for anything that can move. We'll call it CanMove and give it a speed method. And CanMove will be inherited by all things that moveth upon the ground, and that which moveth through the air. And each shall have its own speed method. And then thou shalt behold it and see a job well done!
undefined
3
Task
Java Core, level 3, lesson 2
Locked
Who's that smarty?
Do you know the difference between Smart and Clever? We do too, but that's a topic for another day. Today we're talking about adding the Secretary and Boss interfaces to the Manager and Subordinate classes. Try to figure out for yourself which interface is best for each class. Good luck!
Comments (31)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Jurij Thmsn Level 22 Flensburg Germany
15 February 2021
Bulldozed through these exercises without help, but still don't have the feeling that I get it. Hope it is part of the process and will get clearer in the future ...
ayhem bouabid Level 16 Tunis Tunisia
11 January 2021
The task with Double as a return type instead of double is a tricky one !!
Oliver Heintz Level 18 Mustang United States
30 November 2020
I feel as if I almost know what I'm doing. And then something really silly seems to stump me. But then I figure it out in a few minutes, and I feel stupid, but... I figured it out in a few minutes, so maybe that's ok? I'm a math teacher who, back in May, had ZERO programming experience, and I'm really hoping that next May I can quit teaching math for good because I'm finally good enough to support myself doing this.
Chandan Thapa Level 22 Dubai United Arab Emirates
21 November 2020
Things are getting real now! :)
Vitalina Tkachenko Level 17 Poland
14 November 2020
I finished everything! Let's go next! Good luck everybody and you did really good job if you're here!☺️
joe Level 27 London United Kingdom
20 August 2020
Finished with help from questions but didn't really get this.
Adam Level 25 London United Kingdom
13 August 2020
Cola Beer is awesome though :)
Kent Hervey Level 16 United States
10 May 2020
UML diagrams help...https://en.wikipedia.org/wiki/Class_diagram#/media/File:Uml_classes_en.svg and use <<interfaceName>> to mark interfaces
Dhiraj Level 17 Brussels Belgium
14 January 2020
Can we inherit many interfaces? As stated before... In Java multiple inheritance (Classes) is not allowed. does it not applicable for interfaces?
Vidhya Level 16 Sunnyvale United States
21 December 2019
The question All that Moves we are creating an interface and then create one more then we are kind of overloading the interface method ?Please help me understand