2012420149
package tugas;
import javax.swing.JOptionPane;
/**
*
* @author USER
*/
public class trap2 {
public double t, a, b, sami, K;
public float L;
// Tugas 3
public void jumlah(double Temp){
K = t + a + b + sami;
}
public void jumlah(float Temp){
L = (float) ((a + b)*t/2);
}
public void jumlah(){
System.out.println("K=" + K);
System.out.println("L=" + L);
}
public double gett(){
return t;
}
public void sett(double Temp){
t=Temp;
}
public double geta(){
return a;
}
public void seta(double Temp){
a=Temp;
}
public double getb(){
return b;
}
public void setb(double Temp){
b=Temp;
}
public double getsami(){
return sami;
}
public void setsami(double Temp){
sami=Temp;
}
public double getK(){
return K;
}
public void setK(double Temp){
K=Temp;
}
public float getL(){
return L;
}
public void setL(float Temp){
L=Temp;
}
public static void main(String[] args) {
trap2 x = new trap2();
x.t=Integer.parseInt(JOptionPane.showInputDialog(null,"masukkan tinggi"));
x.a=Integer.parseInt(JOptionPane.showInputDialog(null,"masukkan a"));
x.b=Integer.parseInt(JOptionPane.showInputDialog(null,"masukkan b"));
x.sami=Integer.parseInt(JOptionPane.showInputDialog(null,"masukkan sisi miring"));
x.jumlah(x.getK());
x.jumlah(x.getL());
x.jumlah();
}
}
Posted by 01.24 and have
0
komentar
, Published at
Tidak ada komentar:
Posting Komentar