“สวัสดีทหาร!”
"สวัสดี กัปตันกระรอกครับ!"
"ฉันมีข่าวดีสำหรับคุณ ต่อไปนี้คือแบบฝึกหัดบางส่วนเพื่อเสริมสร้างทักษะของคุณ ทำแบบฝึกหัดเหล่านี้ทุกวัน แล้วความสามารถของคุณจะเพิ่มขึ้นอย่างทวีคูณ แบบฝึกหัดเหล่านี้ได้รับการออกแบบมาเป็นพิเศษสำหรับ IntelliJ IDEA"
"แบบฝึกหัดก่อนหน้านี้มีไว้สำหรับมือใหม่ ฉันได้เพิ่มแบบฝึกหัดโบนัสขั้นสูงเพิ่มเติมสำหรับผู้จับเวลาเก่า เฉพาะสำหรับทหารผ่านศึก"
4
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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
งาน
Java Syntax, ระดับ, บทเรียน
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.