Skip to content

Instantly share code, notes, and snippets.

View Rahandi's full-sized avatar
😄
having fun

Rahandi Noor Pasha Rahandi

😄
having fun
View GitHub Profile
/*
Exercie 2.83
*/
public class Book
{
// The fields.
private String author;
private String title;
/**
* Set the author and title fields when this object
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()
@Rahandi
Rahandi / Binatang.java
Created October 12, 2017 17:55
Overriding
public class Binatang {
public void begerak(){
System.out.println("Binatang bergerak sesuai kemampuannya");
}
public void berkembangBiak(){
System.out.println("Binatang berkembang biak sesuai kemampuannya");
}
}
@Rahandi
Rahandi / Circle.java
Last active October 12, 2017 18:00
Circle
public class Circle {
private double radius;
private String color;
public Circle(){
radius = 1.0;
color = "merah";
}
public Circle(double r){
@Rahandi
Rahandi / MainClass.java
Last active October 12, 2017 18:00
Overloading
public class MainClass {
public static void main(String[] args){
MyClass t = new MyClass(0);
t.info();
t.info("Overloaded method");
new MyClass();
}
}
@Rahandi
Rahandi / Siswa.java
Created October 12, 2017 17:59
Student
public class Siswa {
public static void main() {
Student siswanya = new Student();
String nama;
nama = siswanya.getName();
System.out.println(nama);
siswanya.printGrade();
}
}
@Rahandi
Rahandi / DaftarGaji.java
Last active October 12, 2017 18:06
Gaji
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;
@Rahandi
Rahandi / ATM.java
Created October 19, 2017 17:48
ATM
public class ATM
{
private boolean userAuthenticated;
private int currentAccountNumber;
private Screen screen;
private Keypad keypad;
private CashDispenser cashDispenser;
private DepositSlot depositSlot;
private BankDatabase bankDatabase;
@Rahandi
Rahandi / Account.java
Created October 27, 2017 04:09
E-Toll
public class Account{
private int pin;
private double totalBalance;
public Account(int thePin, double thetotalBalance){
pin = thePin;
totalBalance = thetotalBalance;
}
public boolean validatePIN(int userPIN){
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;