Nim : 5160411022
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double phi,d,t,r;
tabung obj_tabung = new tabung();
Scanner input = new Scanner(System.in);
try {
System.out.println("Input Diameter");
d = input.nextDouble();
System.out.println("Input Tinggi");
t = input.nextDouble();
System.out.println("Input Jari-Jari");
r = input.nextDouble();
obj_tabung.setD(d);
obj_tabung.setR(r);
obj_tabung.setT(t);
System.out.println("Volume Tabung :
"+obj_tabung.volumeTabung());
System.out.println("Luas Lingkaran :
"+obj_tabung.LuasLingkaran());
} catch (Exception e) {
System.out.println(""+e);
}
}
}
Source code Lingkaran
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package projectt_praktek;
/**
*
* @author ditoa
*/
public class lingkaran {
private double phi=3.14;
private double r;
/**
*
* @author ditoa
*/
public class tabung extends lingkaran{
private double phi=3.14;
private double d;
private double t;