7
tugas
Java Syntax, tingkat, wulangan
Minimum of two numbers
Someone is younger, someone else is older. Someone is taller, someone else is shorter. In programming, searching for smaller and larger values is just as important as in the real world. Of course, programming is the real world, right? Let's write a method that compares two integers and returns the minimum.
7
tugas
Java Syntax, tingkat, wulangan
Minimum of three numbers
"Don't compare me with others!" she cried. But comparisons are unavoidable in this world. Especially in programming. Let's take three numbers, look at them, and figure out which one is the smallest. We'll do this using a program, more precisely, a special min method that calculates which number is smaller than the other two.
7
tugas
Java Syntax, tingkat, wulangan
Minimum of four numbers
Four tired cowboys sat in a room. Each of them has to draw a number out of a pot. Whoever of the four draws the smallest number has to go fetch some whiskey. Help these guys determine who has to go. Find the minimum of the four numbers.
1
tugas
Java Syntax, tingkat, wulangan
Repetition is the mother of all learning
In a secret data center, an Agent with three pairs of eyes sits. His brain is built in such a way that he can only perceive what he reads as phrases repeated three times, each time on a new line. Let's help the Agent and send him a message in a format he'll understand. To do this, let's implement the print3 method.
1
tugas
Java Syntax, tingkat, wulangan
Print three times
I do not repeat do not repeat do not repeat in threes in threes in threes. Based on this first sentence, have you already guessed what your task is? If not, here it is: implement the print3 method so that it displays the passed string or word three times on the same line. Don't forget to separate all the words with spaces.
1
tugas
Java Syntax, tingkat, wulangan
Even to the moon!
Programmers often move from place to place, but only if they want to. That's why they love converters so much. Well, maybe that's not why. Still, we will practice writing them. Now imagine that you have to work at a particular location: the Moon. Let's implement a method that converts your Earth weight to your lunar weight.