lat3.java
import java.io.* ;
class loop4{
public static void main(String Arg[]) throws IOException {
int pil, l, s, r, p ;
double ls, vol ;
String str ;
BufferedReader Get=new BufferedReader(new InputStreamReader(System.in)) ;
do{
System.out.println(“Menu Utama”) ;
System.out.println(“1. Hitung Volume Kubus”) ;
System.out.println(“2. Hitung Luas”) ;
System.out.println(“3. Hitung LUas Lingkaran”) ;
System.out.println(“4. Keluar Program”) ;
System.out.print(“Pilihan Anda : “) ; str = Get.readLine() ;
pil = Integer.parseInt(str) ;
switch(pil){
if (pil==1) {
System.out.println(“Menghitung Volume Kubus”) ;
System.out.print(“Sisi : “) ; str = Get.readLine() ;
s = Integer.parseInt(str) ;
vol = s * s * s ;
System.out.println(“Volume Kubus : ” + vol) ;
break ;
}elseif (pil==2){
System.out.println(“Menghitung Luas Persegi Panjang”) ;
System.out.print(“Lebar : “) ; str = Get.readLine() ;
l = Integer.parseInt(str) ;
System.out.print(“Panjang : “) ; str = Get.readLine() ;
p = Integer.parseInt(str) ;
ls = p * l ;
System.out.println(“Luas Persegi Panjang : ” + ls) ;
break ;
}elseif(pil==3){
System.out.println(“Menghitung Luas Lingkaran”) ;
System.out.print(“Jari Jari : “) ; str = Get.readLine() ;
r = Integer.parseInt(str) ;
ls = 3.14 * r * r ;
System.out.print(“Luas Lingkaran : ” + ls) ;
break ;
}
str = Get.readLine() ;
} while( pil != 4) ;
}
}
class loop4{
public static void main(String Arg[]) throws IOException {
int pil, l, s, r, p ;
double ls, vol ;
String str ;
BufferedReader Get=new BufferedReader(new InputStreamReader(System.in)) ;
do{
System.out.println(“Menu Utama”) ;
System.out.println(“1. Hitung Volume Kubus”) ;
System.out.println(“2. Hitung Luas”) ;
System.out.println(“3. Hitung LUas Lingkaran”) ;
System.out.println(“4. Keluar Program”) ;
System.out.print(“Pilihan Anda : “) ; str = Get.readLine() ;
pil = Integer.parseInt(str) ;
switch(pil){
if (pil==1) {
System.out.println(“Menghitung Volume Kubus”) ;
System.out.print(“Sisi : “) ; str = Get.readLine() ;
s = Integer.parseInt(str) ;
vol = s * s * s ;
System.out.println(“Volume Kubus : ” + vol) ;
break ;
}elseif (pil==2){
System.out.println(“Menghitung Luas Persegi Panjang”) ;
System.out.print(“Lebar : “) ; str = Get.readLine() ;
l = Integer.parseInt(str) ;
System.out.print(“Panjang : “) ; str = Get.readLine() ;
p = Integer.parseInt(str) ;
ls = p * l ;
System.out.println(“Luas Persegi Panjang : ” + ls) ;
break ;
}elseif(pil==3){
System.out.println(“Menghitung Luas Lingkaran”) ;
System.out.print(“Jari Jari : “) ; str = Get.readLine() ;
r = Integer.parseInt(str) ;
ls = 3.14 * r * r ;
System.out.print(“Luas Lingkaran : ” + ls) ;
break ;
}
str = Get.readLine() ;
} while( pil != 4) ;
}
}
0 Response to "lat3.java"
Posting Komentar