Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 11th November 2011
Braincode's Avatar
Braincode Braincode is offline
Ceriwis Addicted
 
Join Date: Nov 2011
Posts: 4,638
Rep Power: 20
Braincode mempunyai hidup yang Normal
Default ASK perulangan pada java

halo agan2 programmer semua

saya ada kendala di kuliah dalam pemrograman java..

saya ingin bertanya.

bagaimana cara mengulang suatu program oleh user tanpa menutup program nya.

misal nya

program untuk mencari volume balok seperti ini:




Code:

//
import java.io.*;
class balok1
{
public static void main(String[] args) throws Exception
{
DataInputStream dis = new DataInputStream (System.in);
int p,l,t;
String a,b,c;
double v,L;
System.out.println("Masukkan Panjang :");
a=dis.readLine();
p=Integer.parseInt(a);
System.out.println("Masukkan Lebar :");
b=dis.readLine();
l=Integer.parseInt(b);
System.out.println("Masukkan Tinggi :");
c=dis.readLine();
t=Integer.parseInt(c);
v=p*l*t;
L=2*(p+l+t);
System.out.println("Volumenya :"+v);
System.out.println("Luasnya :"+L);
}
}

bagaimana cara user dapat mencari lagi volume balok tersebut tanpa menutup program atau tanpa program nya di stop.



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 01:37 AM.


no new posts