곱하고 성장하세요
업무 내용이 바뀌었어요! 이제 근무 시간과 주당 근무 일이 유연해졌습니다. 이전에 만든 squareOf5()를 바탕으로 쉽게 답을 구할 수 있겠죠.
이 연습은 강의의 일부입니다
중급 Java
연습 안내
n1과n2에 알맞은 타입을 지정하세요.n1과n2사이에 곱셈에 맞는 연산자를 사용하세요.mult()의return값을 담을 수 있도록hours에 올바른 타입을 지정하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
class Multiplier {
// Give these arguments the proper type
static int mult(____ n1, ____ n2) {
// Use the appropriate operator to get the multiplication of 2 numbers
return n1 ____ n2;
}
public static void main(String[] args) {
int n = 5, m = 6;
// Give the correct type to hours to retrieve the return value of mult
____ hours = mult(n, m);
System.out.println("I'm working " + hours + " hours a week");
}
}