Anda di halaman 1dari 4

Nama : Novian eka saputra

Nim : 5160411022

Source code Project


/*
* 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;
import java.util.Scanner;
/**
*
* @author ditoa
*/
public class ProjectT_Praktek {

/**
* @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;

public double getPhi() {


return phi;
}

public void setPhi(double phi) {


this.phi = phi;
}

public double getR() {


return r;
}

public void setR(double r) {


this.r = r;
}

public double LuasLingkaran()


{
return this.phi*this.r*this.r;
}
}

Source code Tabung


/*
* 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 tabung extends lingkaran{
private double phi=3.14;
private double d;
private double t;

public double getPhi() {


return phi;
}

public void setPhi(double phi) {


this.phi = phi;
}

public double getD() {


return d;
}

public void setD(double d) {


this.d = d;
}

public double getT() {


return t;
}

public void setT(double t) {


this.t = t;
}
public double volumeTabung()
{
return this.phi*this.d*this.d*this.t;
}
}
Output

Anda mungkin juga menyukai