souce code jajar genjang.java
Document Sample


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package menghitungluaskeliling;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author TAXI
*/
public class Main {
public Main() throws IOException{
int a1;
int a2;
int b1;
int b2;
int t;
int k;
float l;
BufferedReader input = new BufferedReader(new
InputStreamReader(System.in));
System.out.println("Nilai alas atas : ");
a1 = Integer.parseInt(input.readLine());
System.out.println("Nilai alas bawah : ");
a2 = Integer.parseInt(input.readLine());
System.out.println("Nilai sisi kanan : ");
b1 = Integer.parseInt(input.readLine());
System.out.println("Nilai sisi kiri : ");
b2 = Integer.parseInt(input.readLine());
System.out.println("Nilai tinggi : ");
t = Integer.parseInt(input.readLine());
k = (int) (a1+a2+b1+b2);
System.out.print("keliling jajar genjang adalah = ");
System.out.println(k);
l = (float) (((a1+a2)*0.5)*t);
System.out.print("luas jajar genjang tersebut adalah = ");
System.out.println(l);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)throws IOException {
// TODO code application logic here
Main m = new Main();
}
}
Get documents about "