Kamis, 24 November 2011

java subroutine

import java.io.*;

public class balok

{

private static BufferedReader stdin=new BufferedReader (new InputStreamReader(System.in));

static double balok (int x, int y, int z)

{

double vol;

vol = x*y*z;

System.out.println(" Volume Balok = "+vol);

return 0;

}

public static void main(String[]args)throws Exception

{

System.out.println("Menghitung Volume Balok");

System.out.println("_____________");

System.out.print("Masukkan Panjang = ");

String Input1=stdin.readLine();

int p=Integer.parseInt(Input1);

System.out.print("Masukkan Lebar = ");

String Input2=stdin.readLine();

int l=Integer.parseInt(Input2);

System.out.print("Masukkan Tinggi = ");

String Input3=stdin.readLine();

int t=Integer.parseInt(Input3);

System.out.println();

balok (p,l,t);

}

}

Tidak ada komentar:

Posting Komentar

silahkan komentari blog ini