Nama : Tri Fatmawati
Prodi : SI_A
NIM : 11090167
Java Meet4
( Aplikasi Lingkaran )
1. Source Kode
package meet4;
import java.util.Scanner;
import java.util.InputMismatchException;
public class Main {
public static void main(String[] args) {
// TODO code application logic here
Scanner in = new Scanner(System.in);
int vnama;
String vnim;
double vphi=3.14;
double vjari;
double hasil;
String jawab;
boolean lanjut=true;
do {
try
{
System.out.print("Masukan Jari-jari : "); vjari=in.nextInt();
hasil= 3.14*vjari*vjari;
System.out.println("Hasil "+3.14+"*"+vjari+"*"+vjari+"="+hasil);
}
catch(InputMismatchException input){
System.out.println("Masukan Double");
in.nextLine();
System.out.println("Coba lagi");jawab=in.next();
if(jawab.equalsIgnoreCase("N")){
in.close();
break;
}else continue;
}
}while(lanjut);
}
}
21.14
No comments
0 komentar:
Posting Komentar
Silakan Tinggalken Pesan