import java.util.Scanner;
public class utama {
public static void main (String[] args){
int x,y;
Scanner putin = new Scanner(System.in);
System.out.print("Masukkan angka pertama : ");
x=putin.nextInt();
System.out.print("Masukkan angka kedua :");
y=putin.nextInt();
indec mv = new indec();
System.out.println();
mv.segitiga();
System.out.println();
relasi mv1 = new relasi();
aritmatika mv2 = new aritmatika();
mv1.putnil(x,y);
mv2.aritmatika1(x,y);
boolean s=mv1.lebih();
boolean d=mv1.kurang();
int f = mv2.tambah();
int j = mv2.kurang();
int k = mv2.kali();
int l = mv2.modul();
float o = mv2.bagi();
System.out.println(x+" > "+y+" = "+s);
System.out.println(x+" < "+y+" = "+d);
System.out.println(x+" + "+y+" = "+f);
System.out.println(x+" - "+y+" = "+j);
System.out.println(x+" x "+y+" = "+k);
System.out.println(x+" % "+y+" = "+l);
System.out.println(x+" : "+y+" = "+o);
}
}
public class aritmatika {
static int x,y;
public static void aritmatika1(int setx,int sety){
x=setx;
y=sety;
}
public int tambah(){return x+y;}
public int kurang(){return x-y;}
public int kali(){return x*y;}
public int modul(){return x%y;}
public float bagi(){return (float)x/(float)y;}
}
public class indec {
public void segitiga(){
for (int iwak=5;iwak>0;iwak--){
for (int peyek=0;peyek<iwak;peyek++){
System.out.print(peyek);
}
System.out.println();
}
}}
public class relasi {
int x,y;
public void putnil(int a, int b){
x=a;
y=b;
}
public boolean lebih(){
return x>y;
}
public boolean kurang(){
return x<y;
}
}
Perhatian :
Nama class harus = nama filenya.!!
Perhatian :
Nama class harus = nama filenya.!!
No comments:
Post a Comment