Assalamualaikum. wr.wb
Kali ini kami akan membahas bagaimana cara pembuatan program ATM dengan menggunakan program Java Eclipse.
Seperti yang kita ketahui eclipse adalah sebuah IDE (Integrated Development Environment) untuk mengembangkan perangkat lunak dan dapat dijalankan di semua platform (platform-independent). Dengan Eclipse, kita dapat membuat berbagai macam aplikasi dengan menggunakan bahasa pemrograman Java. Namun sebelum membuat program, kita harus terlebih dahulu membuat algoritma berupa flowchart dan pseudocode terlebih dahulu. Hal ini dilakukan untuk memaparkan rangkaian cara-cara yang bertahap, sistematis dan logis untuk memecahkan suatu masalah dalam pemrograman.
1.) Flowchart Program ATM
2.) Pseudocode Program ATM
Algoritma
Mesin_ATM
{Membuat
aplikasi mesin atm dengan eclipse}
Deskripsi
Nama, tarik,
bahasa : String
Pin, saldo,sisa,
tes=0 : Integer
Deklarasi
Begin
Read(bahasa)
If
bahasa=1
then
bahasa =
indonesia
End
if
If
bahasa
= 2 then
bahasa = English
End
if
Do
Begin
Read(pin)
tes =
tes+1
If
tes = 3 then
Write
(“ANDA DIBLOKIR”)
End
While
(pin>< 1111 or pin><2222 or pin><3333)
If
pin = 1111 then
nama =
“Cahyo”
saldo =
5000000
End
if
If
pin = 2222 then
nama =
“Tatang”
saldo =
3500000
End
if
If
pin = 3333 then
nama =
“Wati”
saldo =
1750000
End
if
Write(nama)
Write(saldo)
Read(tarik)
If
tarik = 1 then
sisa =
saldo-100000
End
if
If
tarik
= 2 then
sisa =
saldo-300000
End
if
If
tarik
= 3 then
sisa =
saldo-500000
End
if
If
tarik = 4 then
sisa =
saldo-1000000
End
if
If
tarik = 5 then
sisa =
saldo-1500000
End
if
Write(sisa)
End
3.) Listing Eclipse Program ATM
package ATM_HAALIN_13;
import java.util.Scanner;
public class ATM_machine_13 {
public static void main(String[] args) {
// Aplikasi ATM HAALIN 13
Scanner ATM = new Scanner (System.in);
String nama, tarik, bahasa;
int pin, tes=0, saldo, sisa;
System.out.println("***************************************************************");
System.out.println("*************SELAMAT DATANG DI ATM HAALIN 13*******************");
System.out.println("********ATM HAALIN SIAP MELAYANI DUNIA PERBANKAN ANDA**********");
System.out.println("*************KEPUASAN NASABAH ADALAH KEUTAMAAN*****************");
System.out.println("***************************************************************");
System.out.println();
System.out.println();
System.out.println();
System.out.println("MASUKKAN KARTU ANDA");
System.out.println();
System.out.println();
System.out.println();
System.out.println("Selamat datang di ATM HAALIN 13");
System.out.println("Dear, Nasabah YTH");
System.out.println("ATM HAALIN 13 ADALAH ATM yang sederhana namun terpecaya,");
System.out.println("Kami harap anda dapat mematuhi segala peraturan yang diterapkan di ATM HAALIN 13 ");
System.out.println();
System.out.println();
System.out.println("Pilihan bahasa : (1) Bahasa indonesia");
System.out.println(" (2) English");
System.out.println();
System.out.print("Pilih bahasa : ");
bahasa = ATM.next();
if (bahasa.equals("1")) {
do {
System.out.print("Masukkan PIN : ");
pin = ATM.nextInt();
tes = tes +1;
System.out.println();
if (tes== 3){
System.out.println("KARTU ANDA DIBLOKIR!!!!!!!");break;
}
}
while (pin != 1111 && pin != 2222 && pin != 3333);
if (pin ==1111){
nama ="Cahyo";
saldo = 5000000;
System.out.println("Nama Nasabah : " +nama);
System.out.println("Saldo Anda : " +saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
else
if (pin ==2222){
nama = "Tatang";
saldo = 3500000;
System.out.println("Nama Nasabah : " +nama);
System.out.println("Saldo Anda : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
else
if (pin ==3333){
nama = "Wati";
saldo = 1750000;
System.out.println("Nama Nasabah : "+nama);
System.out.println("Saldo Anda : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
}
if (bahasa.equals("2")) {
do {
System.out.print("Enter pin : ");
pin = ATM.nextInt();
tes = tes +1;
System.out.println();
if (tes== 3){
System.out.println("YOUR CARD BLOCKED!!!!!!!");break;
}
}
while (pin != 1111 && pin != 2222 && pin != 3333);
if (pin ==1111){
nama ="Cahyo";
saldo = 5000000;
System.out.println("Name : " +nama);
System.out.println("Your balance : " +saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
else
if (pin ==2222){
nama = "Tatang";
saldo = 3500000;
System.out.println("Name : " +nama);
System.out.println("Your balance : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
else
if (pin ==3333){
nama = "Wati";
saldo = 1750000;
System.out.println("Name : "+nama);
System.out.println("Your balance : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
}
}
}
import java.util.Scanner;
public class ATM_machine_13 {
public static void main(String[] args) {
// Aplikasi ATM HAALIN 13
Scanner ATM = new Scanner (System.in);
String nama, tarik, bahasa;
int pin, tes=0, saldo, sisa;
System.out.println("***************************************************************");
System.out.println("*************SELAMAT DATANG DI ATM HAALIN 13*******************");
System.out.println("********ATM HAALIN SIAP MELAYANI DUNIA PERBANKAN ANDA**********");
System.out.println("*************KEPUASAN NASABAH ADALAH KEUTAMAAN*****************");
System.out.println("***************************************************************");
System.out.println();
System.out.println();
System.out.println();
System.out.println("MASUKKAN KARTU ANDA");
System.out.println();
System.out.println();
System.out.println();
System.out.println("Selamat datang di ATM HAALIN 13");
System.out.println("Dear, Nasabah YTH");
System.out.println("ATM HAALIN 13 ADALAH ATM yang sederhana namun terpecaya,");
System.out.println("Kami harap anda dapat mematuhi segala peraturan yang diterapkan di ATM HAALIN 13 ");
System.out.println();
System.out.println();
System.out.println("Pilihan bahasa : (1) Bahasa indonesia");
System.out.println(" (2) English");
System.out.println();
System.out.print("Pilih bahasa : ");
bahasa = ATM.next();
if (bahasa.equals("1")) {
do {
System.out.print("Masukkan PIN : ");
pin = ATM.nextInt();
tes = tes +1;
System.out.println();
if (tes== 3){
System.out.println("KARTU ANDA DIBLOKIR!!!!!!!");break;
}
}
while (pin != 1111 && pin != 2222 && pin != 3333);
if (pin ==1111){
nama ="Cahyo";
saldo = 5000000;
System.out.println("Nama Nasabah : " +nama);
System.out.println("Saldo Anda : " +saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
else
if (pin ==2222){
nama = "Tatang";
saldo = 3500000;
System.out.println("Nama Nasabah : " +nama);
System.out.println("Saldo Anda : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
else
if (pin ==3333){
nama = "Wati";
saldo = 1750000;
System.out.println("Nama Nasabah : "+nama);
System.out.println("Saldo Anda : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Jumlah penarikan uang : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Pilih jumlah penarikan uang yang akan diambil : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("Anda menarik uang sebesar Rp.100.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("Anda menarik uang sebesar Rp.300.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("Anda menarik uang sebesar Rp.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("Anda menarik uang sebesar Rp.1.000.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("Anda menarik uang sebesar Rp.1.500.000");
System.out.println("Sisa saldo anda : " + sisa);
}
else{
System.out.println("Inputan anda salah!");
}
System.out.println();
System.out.println();
System.out.println("CABUT KARTU ANDA DAN TARIK UANGNYA, TERIMAKASIH ");
}
}
if (bahasa.equals("2")) {
do {
System.out.print("Enter pin : ");
pin = ATM.nextInt();
tes = tes +1;
System.out.println();
if (tes== 3){
System.out.println("YOUR CARD BLOCKED!!!!!!!");break;
}
}
while (pin != 1111 && pin != 2222 && pin != 3333);
if (pin ==1111){
nama ="Cahyo";
saldo = 5000000;
System.out.println("Name : " +nama);
System.out.println("Your balance : " +saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
else
if (pin ==2222){
nama = "Tatang";
saldo = 3500000;
System.out.println("Name : " +nama);
System.out.println("Your balance : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
else
if (pin ==3333){
nama = "Wati";
saldo = 1750000;
System.out.println("Name : "+nama);
System.out.println("Your balance : "+saldo);
System.out.println();
System.out.println();
System.out.println();
System.out.println("Total withdrawal of money : (1) 100.000 ");
System.out.println(" (2) 300.000");
System.out.println(" (3) 500.000");
System.out.println(" (4) 1000.000");
System.out.println(" (5) 1.500.000");
System.out.println();
System.out.println();
System.out.print("Select the number of withdrawals of money to be taken : ");
tarik = ATM.next();
if (tarik.equals("1")) {
sisa = saldo-100000;
System.out.println("You withdraw money for Rp.100.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("2")) {
sisa = saldo-300000;
System.out.println("You withdraw money for Rp.300.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("3")) {
sisa = saldo-500000;
System.out.println("You withdraw money for Rp.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("4")) {
sisa = saldo-1000000;
System.out.println("You withdraw money for Rp.1.000.000");
System.out.println("The rest of your balance : " + sisa);
}
else
if (tarik.equals("5")) {
sisa = saldo-1500000;
System.out.println("You withdraw money for Rp.1.500.000");
System.out.println("The rest of your balance : " + sisa);
}
else{
System.out.println("Wrong input!");
}
System.out.println();
System.out.println();
System.out.println("TAKE YOUR CARD AND PULL THE MONEY, THANKS ");
}
}
}
}
3.) Tampilan input dan output Program ATM
Apabila nasabah memasukkan pin yang salah sebanyak 3 kali, maka kartu ATM akan diblokir
Namun apabila nasabah memasukkan pin yang benar, maka akan muncul pilihan jumlah uang yang akan ditarik. Misal ingin menarik uang sebesar 500.000 maka tekan 3 dan enter.
Setelah menari uang, maka akan muncul jumlah penarikan dan sisa saldo.
Sekian tutorial pembuatan program ATM dengan menggunakan Eclipse. Mudah bukan?
Semoga tulisan ini bermanfaat untuk pembaca sekalian. Sekian dan terimakasih.
Wassalamualaikum wr.wb
0 komentar:
Posting Komentar