"Hello, askar!"
"Hello, Kapten Tupai, tuan!"
"Saya ada berita baik untuk anda. Berikut ialah beberapa latihan untuk mengukuhkan kemahiran anda. Lakukan latihan itu setiap hari, dan kecekapan anda akan berkembang dengan pesat. Ia direka khas untuk IntelliJ IDEA."
"Latihan sebelum ini adalah untuk pemula. Saya telah menambah beberapa latihan bonus yang lebih maju untuk orang lama. Hanya untuk veteran."
4
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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
Tugasan
Java Syntax, tahap, pelajaran
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.