"Xin chào, quân nhân!"
"Xin chào, Đội trưởng Squirrels, thưa ngài!"
"Tôi có một tin tuyệt vời cho bạn. Đây là một số bài tập để củng cố kỹ năng của bạn. Hãy luyện tập chúng hàng ngày và năng lực của bạn sẽ tăng theo cấp số nhân. Chúng được thiết kế đặc biệt cho IntelliJ IDEA."
"Những bài tập trước đó là dành cho tân binh. Tôi đã thêm một số bài tập bổ sung nâng cao hơn cho những người già. Chỉ dành cho những người kỳ cựu."
4
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
8
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
4
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
2
Nhiệm vụ
Java Syntax, mức độ, bài học
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".
8
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
2
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
4
Nhiệm vụ
Java Syntax, mức độ, bài học
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.
8
Nhiệm vụ
Java Syntax, mức độ, bài học
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.