BaşlayınÜcretsiz Başlayın

Çarp ve yüksel

İş tanımın değişti! Artık haftalık çalışma saatlerin ve günlerin esnek. Daha önce yazdığın squareOf5() metodunu temel alarak sonuca kolayca ulaşabileceğini biliyorsun.

Bu egzersiz

Orta Düzey Java

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • n1 ve n2 için uygun türü ver.
  • n1 ile n2 arasında çarpma için uygun işleci kullan.
  • mult() metodunun return değerini tutması için hours değişkenine doğru türü ver.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

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");
  }
}
Kodu Düzenle ve Çalıştır