This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Exercie 2.83 | |
*/ | |
public class Book | |
{ | |
// The fields. | |
private String author; | |
private String title; | |
/** | |
* Set the author and title fields when this object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClockDisplay | |
{ | |
private NumberDisplay hours; | |
private NumberDisplay minutes; | |
private String displayString; // simulates the actual display | |
/** | |
* Constructor for ClockDisplay objects. This constructor | |
* creates a new clock set at 00:00. | |
*/ | |
public ClockDisplay() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Binatang { | |
public void begerak(){ | |
System.out.println("Binatang bergerak sesuai kemampuannya"); | |
} | |
public void berkembangBiak(){ | |
System.out.println("Binatang berkembang biak sesuai kemampuannya"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Circle { | |
private double radius; | |
private String color; | |
public Circle(){ | |
radius = 1.0; | |
color = "merah"; | |
} | |
public Circle(double r){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainClass { | |
public static void main(String[] args){ | |
MyClass t = new MyClass(0); | |
t.info(); | |
t.info("Overloaded method"); | |
new MyClass(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Siswa { | |
public static void main() { | |
Student siswanya = new Student(); | |
String nama; | |
nama = siswanya.getName(); | |
System.out.println(nama); | |
siswanya.printGrade(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DaftarGaji { | |
private Pegawai[] listPegawai; | |
private int jumlahPegawaiSekarang = 0; | |
public DaftarGaji(int jumlah_pegawai){ | |
listPegawai = new Pegawai[jumlah_pegawai]; | |
} | |
public void addPegawai(Pegawai p){ | |
listPegawai[jumlahPegawaiSekarang] = p; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ATM | |
{ | |
private boolean userAuthenticated; | |
private int currentAccountNumber; | |
private Screen screen; | |
private Keypad keypad; | |
private CashDispenser cashDispenser; | |
private DepositSlot depositSlot; | |
private BankDatabase bankDatabase; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Account{ | |
private int pin; | |
private double totalBalance; | |
public Account(int thePin, double thetotalBalance){ | |
pin = thePin; | |
totalBalance = thetotalBalance; | |
} | |
public boolean validatePIN(int userPIN){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Pong; | |
import java.awt.Color; | |
import java.awt.Graphics; | |
import java.util.Random; | |
public class Ball | |
{ | |
public int x, y, width = 25, height = 25; |
OlderNewer