Homework and bonus exercises

Level 1, Lesson 11

"Hey, dude!"

"I hope you're well, Captain Squirrels!"

"I've got awesome news for you. Here are some exercises to reinforce your skills. Do them every day and your skills will grow at an insane speed. They were specially created for you to perform in IntelliJ IDEA."

3
Task
Java Core,  level 1lesson 11
"He took one of his ribs"
Let's create a virtual man. Keeping with tradition, we'll call him Adam. And so he doesn't get lonely, we'll write him a derived class called Eve. Things might not play out quite like in the Bible story, but that's not what we're going for. We are simply trying to understand a very important part of OOP: inheritance.
3
Task
Java Core,  level 1lesson 11
Frenemies
In 2007, Apple announced the very first iPhone. Just as Steve Jobs promised, this event really did change the world. Smartphones have since evolved into all that they are today. The iPhone forced others to create a variety of imitations. Or descendents. Make the SamsungGalaxyS2 class inherit the AppleIPhone class. And may Google forgive us.
3
Task
Java Core,  level 1lesson 11
Playing Darwin
Every school in the Universe probably has classes covering Darwin's famous theory of evolution. So there was a fish, then a bird, then an amphibian, and then mammals... or maybe that's not quite right... But that's not important. In our program, we'll create a fish, a general animal class, an ape and a human. And the fourth will inherit the third, which will inherit the second, which will inherit the first.
3
Task
Java Core,  level 1lesson 11
Evolving classes
We've still got a little more world history to cover on the CodeGym website. Of course, you've heard how dinosaurs came from lizards, which in turn came from fish. This looks like another chance to practice OOP and inheritance. Create three "animal" classes: a parent class, a child class, and a child of the child class.
3
Task
Java Core,  level 1lesson 11
From student to skilled slave
Sigh. Sometimes life seems like it's just a slow transition from one form of slavery to another. First, we have to go to school, and then college, then work, and more work, and more work... until eventually we've been transformed from employees to slaves. Of course, that isn't our destiny. That's why we're learning how to program. Write four classes and make each inherit from the next.
3
Task
Java Core,  level 1lesson 11
Inheritance chain
The spaceship Galaxy Rush has dropped off supplies on Planet Canine in Beagle Galaxy. As a reward for a job well done, the crew was invited to a lecture on canine evolution. Sound boring? No way! It was on this glorious planet, that dogs - the crown jewel of evolution - descended from cats. But that's not how it happened for us! In this task, we'll use the more familiar evolutionary chain found on earth.
3
Task
Java Core,  level 1lesson 11
Alternative inheritance chain
Here we have a class for carnivores - animals and their descendants, such as cows, dogs, and pigs. Imagine what havoc a carnivorous cow could cause if it actually existed! We can't let that happen. Write the inheritance chain correctly!
3
Task
Java Core,  level 1lesson 11
Urban household
OOP may let us fantasize, but before long we need to return to the realm of common sense. For instance, you really like your car, but should you really think of it as a pet or, even worse, your lover? Let's make the inheritance in the program align with common sense.
3
Task
Java Core,  level 1lesson 11
Correct inheritance chain: part 4
"I thought of objects as living cells or individual computers on a network, only able to communicate with messages," said the man who introduced the term "OOP". (Google it if you need to!) We suggest you do the same. Create a proper "inheritance chain" for the House, Cat, Dog, and Car classes.
3
Task
Java Core,  level 1lesson 11
Correct inheritance chain: part 5
Andre, who breeds cats and dogs, doesn't know how to program. He has tearfully asked you to write a program that could help him keep track of his hard-earned assets. And for you that should be easy. Because, as it happens, you're studying OOP and inheritance.

"Those were for rookies. I've added some more advanced bonus exercises for the more experienced. Just for veterans."

3
Task
Java Core,  level 1lesson 11
Strange unfamiliar code
You already know that you'll often have to make sense of unfamiliar code, and that's not just because you're a "junior developer". Here at the secret CodeGym headquarters, we know that it's best to just get used to working with unfamiliar code from the outset. In this task, we'll rearrange the class inheritance so the program compiles and runs.
3
Task
Java Core,  level 1lesson 11
Save the chess club
At CodeGym, we love intellectual diversions. And that includes chess. The king, queen, bishop, rook and pawn are all the pieces used in the game. In this task, you'll have to correct and complete unfamiliar code. More specifically, you need to create a common parent ("chess piece") for all the chess pieces.
7
Task
Java Core,  level 1lesson 11
Minimum and Maximum
During his pre-school entrance exam, Alex, an ordered isomorph from Planet Linear Chaos, was tasked with finding the minimum and maximum values in an array. As you may remember (or not), the only thing that people on this planet do is sort and compare. Alex was able to do it. Can you?
Comments(19)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Corina BodeaLevel 14 , Cluj Napoca
10 April, 15:35
Meanwhile task nb 4 From Schoolboy to Student to Employee "yeeeey.....wait...what?" - to Slave. Cool.
Manish SinhaLevel 20 , london
6 February, 06:21
sweet and simple to gain points.
Russell EULevel 19 , Tashkent
23 December 2019, 21:27
Yeah tasks was easy, but remember about novice, it helpful for them repeatedly solve easy task.
BineshLevel 16
4 November 2019, 23:47
M0v1ng 0n...
Alexandru OvcinicovLevel 15 , London
25 September 2019, 00:10
Thanks for repeating those tasks on this LVL, so i could really get much better !!!
Jonathan FellerLevel 17 , Munich
18 September 2019, 13:50
weak bullshit tasks this time, 10 times the same, pretty disappointing as startup to a new quest
Harvey RobertsLevel 16 , Helsinki
31 August 2019, 04:56
Why does House inherit Asset? I would have thought that an house was a necessity, and a car was an asset.
Noam GLevel 15 , Tel Aviv
21 September 2019, 20:32
Inheritance describes an "is-a" relationship. house is a.. Asset.
Andrew LatobesiLevel 17 , Toronto
21 November 2019, 17:32
A house is an asset (In terms of finances)
Renat MukhametshinLevel 13 , Pervouralsk
29 August 2019, 11:59
ok, good tasks for reinforce basics of inheritance
Boris the LlamaLevel 20 , Maidstone
7 July 2019, 14:56
Very informal greetings from Captain Squirrels and Amigo
EwertonLevel 30 , Belo Horizonte
29 June 2019, 16:42
I think you could reduce or change some tasks here.