undefined

Final tasks

Java Syntax
Level 5 , Lesson 12
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
4
Task
Java Syntax, level 5, lesson 12
Locked
The whole duck isn't enough
This program implements a Duck class, and even creates two specific ducks (two objects). Create a couple more categories of animals similar to the Duck class, namely Cat and Dog. Figure out what the toString method should return in these classes and create pairs of each creature (meaning objects) and display them on the screen.
undefined
8
Task
Java Syntax, level 5, lesson 12
Locked
Man and woman
Creating classes is easy and fun. Let's feel like the creators of a virtual universe and create Man and Woman classes. They must be declared inside the Solution class and be public static. They need to have "name", "age" and "address" fields. We also need to declare constructors with all possible parameters. Then we will be able to use them to create specific objects.
undefined
4
Task
Java Syntax, level 5, lesson 12
Locked
Tom and Jerry
Remember the cartoon "Tom and Jerry"? If you're too young for this, Google will help. And here's why it matters: This cartoon has lots of cats, mice, and dogs. Our task now is to create three classes: Dog, Cat, and Mouse. Each should have three fields. Then create objects of these classes, naming them after the cartoon characters.
undefined
2
Task
Java Syntax, level 5, lesson 12
Locked
Display today's date
Sometimes programmers sit at the computer for days and get lost in time. So if some guy on the street asks you what year it is, it might not be Marty McFly. Maybe he just wrote code for too long. To not get lost, let's display the current date in the following format: "06 15 2018".
undefined
8
Task
Java Syntax, level 5, lesson 12
Locked
Console-based piggy bank
Imagine that we have a piggy bank. You can put coins in it until, at some point, you break it. Let's write a console-based emulator for this piggy bank: We will enter numbers from the keyboard and add them until we "break" the process using the special word "sum". Then the program should calculate how much you have saved.
undefined
2
Task
Java Syntax, level 5, lesson 12
Locked
Boss, something weird is happening
Other people's code is unknown territory. What awaits you there? Perhaps enlightened wolves who chant mantras, or bloodthirsty deer ready to tear your throat open... We don't want to frighten you, but we must warn you that other people's code is full of surprises. Let's dig into the program. In theory, it should sum up two numbers. Let's see what's wrong with it.
undefined
4
Task
Java Syntax, level 5, lesson 12
Locked
Improving functionality
The wisdom of programmers is captured in the following sentence: "If it works, don't touch it!". But what if you need to improve a program's functionality? Alas, 99% of the time, you still have to crawl into someone else's code. Well, let's get to it: there's a program that displays the minimum of two entered numbers. Rewrite it so that it does the same for 5 numbers.
undefined
8
Task
Java Syntax, level 5, lesson 12
Locked
Task about algorithms
Every classical algorithm has been programmed for a long time. Still, tasks about algorithms are very valuable. At the very least, they make the programmer think. There's nothing complicated about the algorithm to find the maximum. So let's not dilly-dally: write a program that takes a positive integer n, takes n numbers, and then finds the maximum of them.
Comments (55)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Dave Level 6, Saskatoon, Canada
7 July 2021
Okay, what's the point of "display today's date". I literally passed all requirements with:

        System.out.println("07 07 2021");

miguel Level 7, Corredor
6 July 2021
I don't understand why in the solution its use arrays, we haven't seen arrays at this point... I was trying with a while loop, but I've had to see another solution... In fact I was not far of the solution.
Myko Level 6, Dresden, Germany
25 December 2020
at the very beginning of the course I had some tasks which were identified as "Epic". But to be honest, they weren´t so mach difficult. The "Task about algorithms"... is not just "Hard", it could easily be specificated as real "Epic" 😸 At this level at least. I sow a few solutions already and spent about 2 days by trying to recognize the way, how this task could be solved... I will try again later 🙄🤦‍♂️
mastere Level 9, Rochester, United States
11 November 2020
Task about algorithms ... I can't figure it out. I think I will come back to it later. I cannot seem to pass the 5th condition.
mastere Level 9, Rochester, United States
11 November 2020
Console-based piggy bank was kind of tough for me. It took me longer than anticipated to clear 3 of the verifications. Finished it after 42 tries though. I kept trying to pass it an int and a string separately, but eventually I figured out I would just have to pass string and check if it was equal to sum and if not then parseInt() to change string to int and then add to sum.
Peter Level 7, Enschede, Netherlands
17 October 2020
Really great exercises but the explanation can be improved a little bit. I've wasted quite some time figuring out a solution because it was not clear that (the first) N meant the amount of numbers to follow. Nevertheless, great exercises and I know now how to figure out the last one with either an array or without an array. Hint: while and if could be sufficient to fix it when not using an array.
Chandan Thapa Level 22, Dubai, United Arab Emirates
9 October 2020
last one was really tricky! had to use help to understand other people's code examples. Finally understood well!!
Tina y Level 6, Toronto, Canada
28 September 2020
It's amazing how for Display today's date problem just typing a single sout line with text worked... I feel like I cheated....
Agent Smith Level 38
12 August 2020
This line of code might come in handy in the Task about algorithms:

int max = Integer.MIN_VALUE;
I strongly encourage you to explore what it does. :-)
Gellert Varga Level 18, Szekesfehervar, Hungary
12 July 2020
A little explanation of the task0532 "Task about algorithms": The first inputted "N" means the number of the subsequent elements (the quantity of the following numbers). It determines how many pieces entered numbers will come after it. So, for example if this is the inputlist: 3, 67, 89, 12, then it means: we have these 3 numbers: 67, 89, 12. The sixth requiremet says: "The program should not display anything if N is less than or equal to 0." So, this first entered "N" can be even zero! Or negative, too. But zero piece element or negative piece is meaningless, therefore in this case the requirement is: "the program should not display anything." Important: We could have even such an input list: 4, -6, -2, -3, -5 . In this case the output should be equal to -2 .