class Lingkaran private private private private

{ double PHI = 3.14; int jari; int posisiX; int posisiY;

public Lingkaran(){ } public Lingkaran(int jari, int X, int Y) { this.jari = jari; this.posisiX = X; this.posisiY = Y; } public void setJari(int jari) { this.jari = jari; } public void setPosisiX(int X) { this.posisiX = X; } public void setPosisiY(int Y) { this.posisiY = Y; } public int getJari() { return (this.jari); } public int getPosisiX() { return (this.posisiX); } public int getPosisiY() { return (this.posisiY); } public void zoom() { this.jari = this.jari*2; } public void pindahPosisi(int x, int y) { this.posisiX = x; this.posisiY = y; } public void cetakInfo() { System.out.println("Info tentang lingkaran "); System.out.println("jari - jari : "+getJari()); //this.jari juga boleh System.out.println("posisi X : "+getPosisiX()); System.out.println("posisi Y : "+getPosisiY()); } } class CobaLingkaran { public static void main(String args[]) { Lingkaran lingkA = new Lingkaran();

2).zoom(). 6.7).cetakInfo().out. System.setJari(5). } } .lingkA.println("lingkaran telah di-zoom dan dipindahkan"). lingkB. lingkA.setPosisiX(4). Lingkaran lingkB = new Lingkaran(2. lingkB.cetakInfo().setPosisiY(3). lingkB. lingkA. lingkB. lingkA.pindahPosisi(4.cetakInfo().

Sign up to vote on this title
UsefulNot useful