CodeGym /Java Course /Java Core /Homework and bonus exercises

Homework and bonus exercises

Java Core
Level 1 , Lesson 11
Available

"Hey, dude!"

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

"I've got awesome tasks for you. Get hands on coding, and your skills will grow at an insane speed."

3
Task
Java Core, level 1, lesson 11
Locked
"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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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.

"And these are advanced bonus exercises for you."

3
Task
Java Core, level 1, lesson 11
Locked
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 1, lesson 11
Locked
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 1, lesson 11
Locked
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 (36)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Xm Level 24, Israel
15 December 2023
last task with streams, Easy!!!

return new Pair<Integer, Integer>(Arrays.stream(array).min().getAsInt(), Arrays.stream(array).max().getAsInt());
Roxana Bodin Level 22, United States of America, United States
21 June 2023
too easy and got bored to complete these repetitive tasks
Anonymous #11267629 (Anouk) Level 27, Netherlands Expert
27 April 2023
It was indeed very easy, but it is always good to practise the basic. If it is too complicated in the beginning, you maybe get lost.
Taylor David Level 25, United States of America, United States
23 March 2023
Talk about superfluous
Gabriel Brown Level 19, United States of America, United States
5 July 2022
Really dont think I need to do the same task slightly changed 30 times to understand inheritance.
matemate123 Level 50, Kraków, Poland
26 December 2022
I agree, in Java Syntax was places where can be more more tasks to compose knowledge and train, but here is ridiculous. Only last task was fun.
Anonymous #10782038 Level 24, United States of America
29 March 2024
yeah though its always good to get that muscle memory in. Also you can always just skip them.
Michael Amann Level 22, United States of America, United States
17 May 2022
Dogs are NOT carnivores. Carnivores ONLY eat meat. Hasn't a dog ever eaten your homework?
RolandHut Level 23, Groningen, Netherlands
26 July 2022
Dogs ARE Carnivores, just not obligate carnivores. Non obligate carnivores need meat in their diet but can eat other food perfectly fine, obligate carnivores (like cats) can only survive off meat.
Daniel Ketcheson Level 28, Canada
2 June 2023
But paper comes from a plant
Michael Amann Level 22, United States of America, United States
17 May 2022
Shouldn't fish be derived from Animal?
TheLordJackMC Level 39, Princeton, idk somewhere
15 July 2021
every time: ATTENTION SIR today: yoooooo its ma boiii
ImDevin Level 15, Old Town, United States
22 May 2021
ah, the arrays, arrays, arrays. just when you think there can't be any more to do with the array, there's another!! :)
Edddieg Level 15, Providence, United States
27 July 2020
was there inheritance in the last task?
Clint Level 22, cincinnati, united states
23 November 2020
no