Classes and Objects Muhammad Izzuddin A (05111740000035) Kelas B A. Time class study (Fig 8.1 - 8.2) Class yang dibuat: Time1 dan Time1Test Overview class diagram: Berikut source code dari kelas Time1 : /** * Program Kelas Time1 (Fig. 8.1) * Deklarasi Kelas Time1, mengelola waktu dalam format 24h * * @author Muhammad Izzuddin A */ public class Time1 { // instance variables - replace the example below with your own private int hour; private int minute; private int second; /** * Setter method * @param h hour * @param m minute * @param s second */ public void setTime(int h, int m, int s) { if ((h >= 0 && h < 24) && (m >= 0 && m < 60) && (s >= 0 && s < 60)){ hour = h; minute = m; second = s; } else { throw new IllegalArgumentException("Hour, Minute and/or Second was out of range");...
Comments
Post a Comment