CodeGym /Courses /New Java Syntax /Practice calling methods

Practice calling methods

New Java Syntax
Level 7 , Lesson 4
Available

"Hi, Amigo. I’d like to give you a couple of tasks:"

7
Task
New Java Syntax, level 7, lesson 4
Locked
Minimum of two numbers
Write a function that returns the minimum of two numbers. Hint: You need to write the body of the existing min function.
7
Task
New Java Syntax, level 7, lesson 4
Locked
Minimum of three numbers
Write a function that computes the minimum of three numbers. Hint: You need to write the body of the existing min function.
7
Task
New Java Syntax, level 7, lesson 4
Locked
Minimum of four numbers
Write a function that computes the minimum of four numbers. The function min(a, b, c, d) should use (call) the function min(a, b) Hint: You need to write the body of the two existing min functions.
7
Task
New Java Syntax, level 7, lesson 4
Locked
Repetition is the mother of all learning
Implement the print3 method. The method should display the passed string 3 times. Each time, on a new line.
7
Task
New Java Syntax, level 7, lesson 4
Locked
Print three times
Implement the print3 method. The method should display the passed string (word) three times, but on the same line. Words must be separated by a space and should not merge into one.
7
Task
New Java Syntax, level 7, lesson 4
Locked
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.
Comments (188)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Naif Al-Jaaidi Level 9, Aden, Yemen
29 December 2023
You have to put point zero in any number to get the result in floating point: return number * 17 / 100.0; or return number * 17.0 / 100; or both return number * 17.0 / 100.0; and not return number * 17 / 100;
Simphiwe Level 33, Johannesburg, South Africa
14 February 2023
(double) 17/100 * number to find the percentage.
Edariel Level 3, Praha, Czech Repuclic
29 April 2023
double number * 0.17 is shorter
Simphiwe Level 33, Johannesburg, South Africa
17 May 2023
noted
JuanmaZo Level 2, Spain
13 January 2023
chavales denle codigo
13 January 2023
/* Comment has been deleted */
Anonymous #11151001 Level 2, Spain
13 January 2023
En la grada, viva el Betis, gritaré Luchando por mi equipo, yo me dejaré la piel Esta noche quebraremos nuestra voz Perderemos la garganta, esto sí es una afición
13 January 2023
no perdemos la esperanza hasta el final y hasta el ultimo segundo no paramos de cantaaar. Soy del BETIS y tengo verde el corazón, yo blanca tengo el alma, vamos BETIS CAMPEÓN
Leyfon Level 8, Italy
7 November 2022
i love codeGym but this time they did a mistake. Is just not fair giving us Epic exercisez WITHOUT things already explained in the theory. They never explained us how if else cycle work or ternary operator works. I hope they won't repeat this mistake or i'll lose the will of continue
Chrisantus Makokha Level 32, Nairobi, Kenya
11 December 2022
That's a mistake you will see over and over. They actually explain at some point that certain material you will find them ahead but they expect you to do the exercise so that you can also do some research on your own. It helps in learning. When you come across that material you already know one or two things about that topic.
Leyfon Level 8, Italy
21 December 2022
Yeah i noticed since i did lot more I'm still against this mindset they have, because the beginner would be frustrated, but i still love the way how they explain, i find them better than any books. So i just got used to it Ty for the answer in any case mate
Santhiago Level 4, São Paulo , Brazil
21 March 2023
We need to do a resesearch about the solution. But I learnt a lot when I do it.
Juan Andrés Espino Moreno Level 3, Madrid, Spain
2 August 2022
Que el ritmo no pare !!!!
Кирилл Клюенко Level 7, Одесса
23 May 2022
Hi there ! You guys can solve this problem with StringBuilder. It will be a little more interesting.
Say Bee Level 9, United States of America, United States
12 April 2022
Ended up having to YT some videos on methods/return statements, but I'm glad I did! It was worth it to finally figure these out 😁
Joshua Zellner Level 11, United States of America, United States
12 April 2022
This was really helpful!!!