/*
* I DEWA GDE AGUNG WIRA ADNYANA
* 10101056
*/
package soal1;
/**
*
* @authorWIRA_10101065
*/
import java.util.Scanner;
class tabung {
int pilihan;
double r;
double t;
double luas(){
double hasil1 = (2*3.14*r*r) + 2*3.14*r*t;
return hasil1;
}
double volume(){
double hasil2 = 3.14*r*r*t;
return hasil2;
}
double kll(){
double hasil3 = 2* (2*3.14*r*t);
return hasil3;
}
}
class tugas3arya{
public static void main(String[] args){
System.out.println(" Program Menghitung L/V/Kll Tabung ");
System.out.println("---------------------------------------------");
System.out.println(" I DEWA GDE AGUNG WIRA ADNYANA ");
System.out.println(" 10101056 ");
System.out.println("---------------------------------------------");
System.out.println("");
tabung tb = new tabung();
Scanner input = new Scanner (System.in);
System.out.println("MENU");
System.out.println("1. Luas Tabung");
System.out.println("2. Volume Tabung");
System.out.println("3. Keliling Tabung");
System.out.println("");
System.out.printf("Masukkan Pilihan : ");
System.out.println("");
tb.pilihan = input.nextInt();
System.out.println("");
if(tb.pilihan == 1){
System.out.println("--MENCARI LUAS TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Luas Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.luas());
System.out.println("");
}
else if(tb.pilihan == 2){
System.out.println("--MENCARI VOLUME TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Volume Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.volume());
System.out.println("");
}
else if (tb.pilihan == 3) {
System.out.println("--MENCARI KELILING TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Keliling Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.kll());
System.out.println("");
}
else {
System.out.println("MENU PILIHAN TIDAK TERSEDIA");
}
}
}
* I DEWA GDE AGUNG WIRA ADNYANA
* 10101056
*/
package soal1;
/**
*
* @authorWIRA_10101065
*/
import java.util.Scanner;
class tabung {
int pilihan;
double r;
double t;
double luas(){
double hasil1 = (2*3.14*r*r) + 2*3.14*r*t;
return hasil1;
}
double volume(){
double hasil2 = 3.14*r*r*t;
return hasil2;
}
double kll(){
double hasil3 = 2* (2*3.14*r*t);
return hasil3;
}
}
class tugas3arya{
public static void main(String[] args){
System.out.println(" Program Menghitung L/V/Kll Tabung ");
System.out.println("---------------------------------------------");
System.out.println(" I DEWA GDE AGUNG WIRA ADNYANA ");
System.out.println(" 10101056 ");
System.out.println("---------------------------------------------");
System.out.println("");
tabung tb = new tabung();
Scanner input = new Scanner (System.in);
System.out.println("MENU");
System.out.println("1. Luas Tabung");
System.out.println("2. Volume Tabung");
System.out.println("3. Keliling Tabung");
System.out.println("");
System.out.printf("Masukkan Pilihan : ");
System.out.println("");
tb.pilihan = input.nextInt();
System.out.println("");
if(tb.pilihan == 1){
System.out.println("--MENCARI LUAS TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Luas Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.luas());
System.out.println("");
}
else if(tb.pilihan == 2){
System.out.println("--MENCARI VOLUME TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Volume Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.volume());
System.out.println("");
}
else if (tb.pilihan == 3) {
System.out.println("--MENCARI KELILING TABUNG--");
System.out.println("");
System.out.printf("Masukkan Jari-jari : ");
tb.r = input.nextInt();
System.out.printf("Masukkan tinggi : ");
tb.t = input.nextInt();
System.out.println("");
System.out.println("Keliling Tabung dengan jari-jari " +tb.r + " dan tinggi " +tb.t + " : " +tb.kll());
System.out.println("");
}
else {
System.out.println("MENU PILIHAN TIDAK TERSEDIA");
}
}
}
0 komentar:
Posting Komentar