Multiply and prosper
आपकी जॉब डिस्क्रिप्शन बदल गई है! अब आपके पास flexible hours और week के दिनों में लचीलापन है. आपको पता है कि आप पहले बनाया हुआ squareOf5() इस्तेमाल करके आसानी से जवाब तक पहुँच सकते हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
इंटरमीडिएट Java
अभ्यास निर्देश
n1औरn2को उनका सही टाइप दें.n1औरn2के बीच multiplication के लिए उचित ऑपरेटर का इस्तेमाल करें.mult()केreturnvalue को रखने के लिए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");
}
}