/**
* Mengenal Bluej.
*
* @author M Thalut Nadhil
* @version (1/2082020202)
*/
public class Helloworld
{
// instance variables - replace the example below with your own
private int x;
/**
* Constructor for objects of class Helloworld
*/
public Helloworld()
{
// initialise instance variables
x = 0;
System.out.print("Hello world");
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public int sampleMethod(int y)
{
// put your code here
return x + y;
}
}
Tugas Membuat Digital Clock Dibawah ini merupakan Gambar classnya Dibawah ini Merupakan Codingan dari Class Clock Display : /** * Codingan Clock Display * * @author M Thalut Nadhil Q * @version 5 */ public class ClockDisplay { private NumberDisplay jam; private NumberDisplay menit; private String displayString; public ClockDisplay() { jam = new NumberDisplay(24); menit = new NumberDisplay(60); updateDisplay(); } public ClockDisplay(int hour, int minute) { jam = new NumberDisplay(24); menit = new NumberDisplay(60); setTime(hour,minute); } public void timeTick() { menit.increment(); if(menit.getValue() == 0) { jam.increment(); } updateDisplay(); } public void setTime(int hour, int minute) { jam.setValue(hour); menit.setValue(minute); updateDisplay(); } ...
Komentar
Posting Komentar