Fat’s Albojongi

Just another WordPress.com weblog

kuis java di kampus

Posted by fatoni95 pada Februari 1, 2009

<!– /* Font Definitions */ @font-face {font-family:”Traditional Arabic”; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:178; mso-generic-font-family:auto; mso-font-format:other; mso-font-pitch:variable; mso-font-signature:8193 0 0 0 64 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:””; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; mso-bidi-font-size:20.0pt; font-family:”Times New Roman”; mso-fareast-font-family:”Times New Roman”; mso-bidi-font-family:”Traditional Arabic”;} @page Section1 {size:612.1pt 936.1pt; margin:56.7pt 56.7pt 155.95pt 56.7pt; mso-header-margin:.5in; mso-footer-margin:127.6pt; mso-paper-source:0;} div.Section1 {page:Section1;} –>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:””;
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:”Times New Roman”;
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}

KUIS JAVA STMIK CIC

import java.io.*;

public class Quiz

{

public static void main(String[]arg)throws IOException

{

BufferedReader datain=new BufferedReader(new InputStreamReader(System.in));

int p,l,k;

float m,km;

double rp,$;

int a,j,i;

int pilihan;

do

{

System.out.println(“MENU PILIHAN”);

System.out.println(“1.Keliling Persegi Panjang”);

System.out.println(“2.Konversi Jarak (m -> km)”);

System.out.println(“3.Kurs Mata Uang (Rp -> US$)”);

System.out.println(“4.Deret”);

System.out.println(“0.Keluar”);

System.out.print(“Pilihan Anda??”);

pilihan=Integer.parseInt(datain.readLine());

if(pilihan==1)

{

System.out.print(“Masukkan Panjang: “);

p=Integer.parseInt(datain.readLine());

System.out.print(“Masukkan Lebar: “);

l=Integer.parseInt(datain.readLine());

k=(2*p)+(2*l);

System.out.println(“===================================”);

System.out.println(“Keliling Persegi Panjang Adalah : “+k);

}

else if(pilihan==2)

{

System.out.print(“Masukkan Panjang M: “);

m=Float.parseFloat(datain.readLine());

km=m/1000;

System.out.println(“===================================”);

System.out.println(m+” Meter = “+km+” Kilometer”);

}

else if(pilihan==3)

{

System.out.print(“Masukkan Nilai Rp: “);

rp=Double.parseDouble(datain.readLine());

$=rp/11400;

System.out.println(“===================================”);

System.out.println(“Rp “+rp+”= US$ “+$);

}

else if(pilihan==4)

{

System.out.print(“Nilai Awal: “);

a=Integer.parseInt(datain.readLine());

System.out.print(“Jumlah Deret: “);

j=Integer.parseInt(datain.readLine());

System.out.print(a+””);

j=j-1;

for(i=1;i<=j;i++)

{

a=a-2;

System.out.print(” “+a);

}

}

else

System.out.println(“Data yang Anda Masukkan Error!!!”);

System.out.print(“\n”);

System.out.println(“\n”);

System.out.println(“Thank you from Deni Iskandar”);

System.out.println(“===================================”);

}

while(pilihan!=0);

}

}

import java.io.BufferedReader;

import java.io.InputStreamReader;

import java.io.IOException;

import java.io.*;

import java.lang.*;

import javax.swing.*;

import java.lang.String;

public class Quizjava1

{

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

{

BufferedReader dataIn = new BufferedReader(new InputStreamReader( System.in) );

double p,l,kll;

double m,km;

double rp,dol;

double der,a,i,z;

System.out.print(“*****MENU UTAMA*****”);

System.out.print(“\n\n”);

System.out.println(“1. Keliling Persegi Panjang”);

System.out.println(“2. Konversi Jarak (meter ==> kilometer”);

System.out.println(“3. Kurs Mata Uang (Rp ==> US$”);

System.out.println(“4. Deret Mundur (-2)”);

System.out.println(“0. Keluar”);

System.out.print(“\n”);

String pilihan=JOptionPane.showInputDialog (“*****MENU UTAMA ***** :\n\n1.

Keliling Persegi Panjang\n2. Konversi Jarak (M==>KM)\n3. Kurs Mata Uang

(Rp==>US$)\n4. Deret\n0. Exit\n Pilihan Anda = “);

int pilih=Integer.parseInt (pilihan);

switch (pilih)

{

case 1 :

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

p = Double.parseDouble(dataIn.readLine());

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

l = Double.parseDouble(dataIn.readLine());

kll=(p+l)*2;

System.out.println(“Keliling persegi panjang adalah = ” + kll);

break;

case 2 :

System.out.print(“Masukkan Ukuran dalam Meter = “);

m = Double.parseDouble(dataIn.readLine());

km = m / 1000;

System.out.println(m + ” meter = ” + km + ” kilometer”); break;

case 3 :

System.out.print(“Masukkan Nilai Rupiah = “);

rp = Double.parseDouble(dataIn.readLine());

dol = rp / 11400;

System.out.println(rp + ” rupiah = ” + dol + ” US$”);

break;

case 4 :

System.out.print(“Masukkan Suku Ke-1 = “);

a = Double.parseDouble(dataIn.readLine());

System.out.print(“Mau Diulang berapa kali = “);

der = Double.parseDouble(dataIn.readLine());

System.out.println(a);

for (i=2;i<=der;i++)

{

for (z=2;z<=der;z++)

{

i=a-2;

System.out.println(i);

a=i;

if (i==0)

{

System.exit(0);

}

}

}

break;

case 0 :

System.out.println(“Bye…bye…..”);

break;

default : System.out.println(“Maaf, menu tidak tersedia”);

break;

}

System.exit(0);

}

}

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

 
%d blogger menyukai ini: