bahasa java

Program Penukaran Uang Receh

import java.io.*;
public class receh{
public static void main(String[] args) {
BufferedReader nilai = new BufferedReader (new InputStreamReader(System.in));
String uang=””;
int angka=0;
int sisa1=0,sisa2=0,sisa3=0,sisa4=0,sisa5=0,sisa6=0,sisa7=0,sisa8=0,sisa9=0,sisa10=0;
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0;
System.out.println(“=====MENGHITUNG JUMLAH RECEHAN=====\n”);
System.out.print(“Masukkan Jumlah Uang : “);
try {
uang = nilai.readLine();
angka = Integer.parseInt(uang);
}catch (IOException E){}
System.out.println(“”);
if (angka>=50000)
{a = angka/50000;
sisa1 = angka%50000;
b = sisa1/20000;
sisa2 = sisa1%20000;
c = sisa2/10000;
sisa3 = sisa2%10000;
d = sisa3/5000;
sisa4 = sisa3%5000;
e = sisa4/2000;
sisa5 = sisa4%2000;
f = sisa5/1000;
sisa6 = sisa5%1000;
g = sisa6/500;
sisa7 = sisa6%500;
h = sisa7/200;
sisa8 = sisa7%200;
i = sisa8/100;
sisa9 = sisa8%100;
j = sisa9/50;
sisa10 = sisa9%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” + sisa10);}
else if (angka>=20000)
{b = angka/20000;
sisa1 = angka%20000;
c = sisa1/10000;
sisa2 = sisa1%10000;
d = sisa2/5000;
sisa3 = sisa2%5000;
e = sisa3/2000;
sisa4 = sisa3%2000;
f = sisa4/1000;
sisa5 = sisa4%1000;
g = sisa5/500;
sisa6 = sisa5%500;
h = sisa6/200;
sisa7 = sisa6%200;
i = sisa7/100;
sisa8 = sisa7%100;
j = sisa8/50;
sisa9 = sisa8%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa9);}
else if (angka>=10000)
{c = angka/10000;
sisa1 = angka%10000;
d = sisa1/5000;
sisa2 = sisa1%5000;
e = sisa2/2000;
sisa3 = sisa2%2000;
f = sisa3/1000;
sisa4 = sisa3%1000;
g = sisa4/500;
sisa5 = sisa4%500;
h = sisa5/200;
sisa6 = sisa5%200;
i = sisa6/100;
sisa7 = sisa6%100;
j = sisa7/50;
sisa8 = sisa7%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa8);}
else if (angka>=5000)
{d = angka/5000;
sisa1 = angka%5000;
e = sisa1/2000;
sisa2 = sisa1%2000;
f = sisa2/1000;
sisa3 = sisa2%1000;
g = sisa3/500;
sisa4 = sisa3%500;
h = sisa4/200;
sisa5 = sisa4%200;
i = sisa5/100;
sisa6 = sisa5%100;
j = sisa6/50;
sisa7 = sisa8%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa7);}
else if (angka>=2000)
{e = angka/2000;
sisa1 = angka%2000;
f = sisa1/1000;
sisa2 = sisa1%1000;
g = sisa2/500;
sisa3 = sisa2%500;
h = sisa3/200;
sisa4 = sisa3%200;
i = sisa4/100;
sisa5 = sisa4%100;
j = sisa5/50;
sisa6 = sisa5%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa6);}
else if (angka>=1000)
{f = angka/1000;
sisa1 = angka%1000;
g = sisa1/500;
sisa2 = sisa1%500;
h = sisa2/200;
sisa3 = sisa2%200;
i = sisa3/100;
sisa4 = sisa3%100;
j = sisa4/50;
sisa5 = sisa4%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa5);}
else if (angka>=500)
{g = angka/500;
sisa1 = angka%500;
h = sisa1/200;
sisa2 = sisa1%200;
i = sisa2/100;
sisa3 = sisa2%100;
j = sisa3/50;
sisa4 = sisa3%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa4);}
else if (angka>=200)
{h = angka/200;
sisa1 = angka%200;
i = sisa1/100;
sisa2 = sisa1%100;
j = sisa2/50;
sisa3 = sisa2%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa3);}
else if (angka>=100)
{i = angka/100;
sisa1 = angka%100;
j = sisa1/50;
sisa2 = sisa1%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa2);}
else
{j = angka/50;
sisa1 = angka%50;
System.out.println(“Rp.50.000 = “+a);
System.out.println(“Rp.20.000 = “+b);
System.out.println(“Rp.10.000 = “+c);
System.out.println(“Rp. 5.000 = “+d);
System.out.println(“Rp. 2.000 = “+e);
System.out.println(“Rp. 1.000 = “+f);
System.out.println(“Rp.   500 = “+g);
System.out.println(“Rp.   200 = “+h);
System.out.println(“Rp.   100 = “+i);
System.out.println(“Rp.    50 = “+j);
System.out.println(“Sisa RP.” +sisa1);}

}
}

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: