Pages

Jumat, 29 November 2013

program ATM


Tutorial Program mesin atm
Pendahuluan
Program Mesin ATM adalah program yang sangat banyak digunakan oleh para nasabah untuk berbagai keperluan keuangan, semisal seperti transfer, dan penarikan tunai,  saat ini berbagai bank telah melakukan berbagai jenis ATM sesuai dengan bank masing-masing, nah, nantinya kami berharap bahwaa program ini nantinya dapat digunakan keperluan umum dan diharapkan manfaatnya kepada para user maupun para masyarakat yang sering menggunakan fasilitas banking.
A.1.1 Flowchart
  

A.1.2. PSEUDOCODE



            Pseudocode
Algoritma Menggunakan_mesin_ATM
{menggunakan ATM dengan menginputkan password  dan data user}
Deklarasi
nilai, no_rek, Tarik, penarikan1,penarikan2,penarika3, penarikan4, akun1, akun2, akun3: integer
status : boolean
saldo : double
bahasa : byte
pilihan : long
akun1               2400000
akun2               1600000
akun3               2300000
penarikan1           100000
penarikan2           200000
penarikan3           500000
penarikan4           1000000

deskripsi
Begin
While (status = true)
read(bahasa)
if ( bahasa = 1 ) then
read (password)
if (password = 20072) then
                read(pilihan)
                if (pilihan = 1) then // transfer
                                read (no_rek)
                                read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun1
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun1-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun1 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun1 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun1 – penarikan4)
                                else
                                                write(“please insert correctly!!”)
                                                status = true
                                end if
if (password = 20004) then
                read(pilihan)
                if (pilihan = 1) then // transfer
                                read (no_rek)
                                read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun2
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun2-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun2 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun2 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun2 – penarikan4)
                                else
                                                write(“please insert correctly!! ”)
                                                status = true
                                end if
if (password = 20024) then
                read(pilihan)
                if (pilihan = 1) then // transfer
                                read (no_rek)
read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun3
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun3-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun3 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun3 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun4 – penarikan4)
                                else
                                                write(“please insert correctly!! ”)
                                                status = true
                                end if
else
                                write(“please insert correctly!! ”)
                                status = true
end if
else
                write(“please insert correctly!! ”)
                status = true
end if
else
write(“please insert correctly!! ”)
status = true
end if
read(bahasa)
if ( bahasa =2 ) then
read (password)
if (password = 20072) then
                read(pilihan)
                if (pilihan = 1) then // transfer
                                read (no_rek)
                                read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun1
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun1-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun1 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun1 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun1 – penarikan4)
                                else
                                                write(“please insert correctly!!”)
                                                status = true
                                end if
if (password = 20004) then
                read(pilihan)
                if (pilihan = 1) then // transfer
read (no_rek)
                                read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun2
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun2-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun2 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun2 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun2 – penarikan4)
                                else
                                                write(“masukkan kode dengan jelas!! ”)
                                                status = true
                                end if
if (password = 20024) then
                read(pilihan)
                if (pilihan = 1) then // transfer
                                read (no_rek)
read (nilai)
                else if (pilihan = 2) then // cek saldo
                                saldo = akun3
                else if ( pilihan = 3) then // penarikan
                                if ( tarik = 1) then
                                                saldo = (akun3-penarikan1)
                                else if (tarik = 2) then
                                                saldo = (akun3 – penarikan2)
                                else if (tarik = 3) then
                                                saldo = (akun3 – penarikan3)
                                else if (tarik = 4) then
                                                saldo = (akun4 – penarikan4)
                                else
                                                write(“masukkan kode dengan jelas!! ”)
                                                status = true
                                end if
else
                                write(“masukkan kode dengan jelas!!”)
                                status = true
end if
else
                write(“masukkan kode dengan jelas!!”)
                status = true
end if
else
write(“masukkan kode dengan jelas!!”)
status = true
end if                     
writeln(saldo)
writeln(no_rek)
writeln(nilai)
END

A.1.3 Listing Eclipse
            Berikut penulisan Listing untuk pendeklarasian variabel-variabel yang ada dalam program tersebut.
package atme;

import java.util.Scanner;

public class atmee {
       // Deklarasi fungsi untuk memasukkan spasi ketika jumlah karakter yg diinput kurang dari "pjg"
              public static void main(String[] args) {       
             
              Scanner ben = new Scanner (System.in);
              int akun1,akun2,akun3;
              akun1 = 24000000;
              akun2 = 16000000;
              akun3 = 21000000;
              int tarik,penarikan1,penarikan2,penarikan3,penarikan4;
              penarikan1 = 100000;
              penarikan2 = 200000;
              penarikan3 = 500000;
              penarikan4 = 1000000;
              //nilai integer untuk tiap konstanta
              double saldo;
              long pilihan;
              byte bahasa;
              boolean status;
              double password;
              double no_rek;
              double nilai;
}}
Kami menyertakan type data Boolean untuk menentukan hasil akhir perhitungan atau pemrosesan suatu method hingga benar, namun apabila suatu kondisi dinyatakan salah oleh perhitungan akhir program maka program akan dirunning kembali dimana dia menggunakan macam-macam perulangan atau looping. ( while, do while, for).
System.out.println(" ____________________________________");
              System.out.println("|NINE BANKING____________NINE BANKING|");
              System.out.println("|____________NINE BANKING____________|");
              System.out.println("|INPUTKAN BAHASA,CHOOSE YOUR LANGUAGE|");
              System.out.println("|  1 for english                     |");
              System.out.println("|  2 untuk bahasa indonesia:         |");
              System.out.println("|____________________________________|");
              System.out.println("          INPUT/CHOOSE: ");
Seperti inilah tampilan listing untuk menampilkan menu awal pada program,  tidak ada kriteria khusus untuk bagian ini.
              bahasa = ben.nextByte();
              while (status = true)
              if (bahasa == 1){
                     while(status=true){
                     System.out.println("hello?, welcome to NINE BANKING");
                     System.out.print("please insert your password!");

Penggunaan scanner ben pada program ini yaitu untuk membaca input yang kita inputkan nantinya sewaktu melakukan kerja..
Penempatan while diatas percabangan if diatas adalah apabila program dijalankan dan menemui kesalahan maka dengan cepat program akan kembali ke tampilan awal.
Permintaan penginputan password akan ditampilkan pada listing dibawah ini.
password = ben.nextDouble();
                     if (password == 20072){
                           while(status = true){
                           System.out.println(" hallo Andry?");
                           System.out.println(" please choose :");
                           System.out.println(" 1 for transfer");
                           System.out.println(" 2 for check your burst");
                           System.out.println(" 3 for money retraction");
                           System.out.print("choose :");
                                     
Ada tiga pemilihan input yaitu 1,2 dan 3, namun apabila anda menginput nilai selain yang diminta oleh program, maka program akan segera mengulang dan menampilkan menu tampilan awal saat deprogram tadi tergantung dimana kita menempatkan whilenya.
pilihan = ben.nextLong();
                                                if (pilihan == 1){{
                                                            System.out.print("input the number of account :");
                                                            no_rek = ben.nextDouble();
                                                    System.out.print("much of transfer");
                                                    nilai = ben.nextDouble();
                                                            if (( no_rek > 0) || (nilai >0)){
                                                                        System.out.print("SUCCES FOR TRANSFER!");
                                                                            System.out.println("_________________________________________");
                                                                            System.out.println("you has transfer for "+no_rek);
                                                                                    System.out.println("amount of Rp"+nilai);}
                                                            else{
                                                                                    System.out.println("please insert correctly!!");
                                                                                    status = true;
                                                                                                break;}
                                                            }}
                                                else if(pilihan == 2){
                                                             System.out.println("your burst is Rp" + akun1);
                                                             System.out.println("always use Nine Banking");
                                                             status = true;
                                                             }
                                                else if(pilihan == 3){
                                                             System.out.println("how many you want?");
                                                             System.out.println("choose 1 for Rp 100.000");
                                                             System.out.println("choose 2 for Rp 200.000");
                                                             System.out.println("choose 3 for Rp 500.000");
                                                             System.out.println("choose 4 for Rp 1.000.000");
                                                             System.out.print("input :");
                                                             tarik = ben.nextInt();
                                                             {
                                                             if ( tarik ==1){
                                                                                     saldo = (akun1 -penarikan1);
                                                                                     System.out.println("wait......");
                                                                                     System.out.println("____________________________________");
                                                                                     System.out.println("your take amount of Rp "+penarikan4);
                                                                                     System.out.println("your burst is Rp "+saldo);
                                                                                     System.out.println("");
                                                                                     
                                                                                     status = true;
                                                                         }
                                                             else if ( tarik ==2){
                                                                                     saldo = (akun1 -penarikan2);
                                                                                     System.out.println("wait......");
                                                                                     System.out.println("____________________________________");
                                                                                     System.out.println("your take amount of Rp "+penarikan4);
                                                                                     System.out.println("your burst is Rp "+saldo);
                                                                                     System.out.println("");
                                                                                     
                                                                                     status = true;
                                                                         }
                                                             else if ( tarik ==3){
                                                                                     saldo = (akun1 -penarikan3);
                                                                                     System.out.println("wait......");
                                                                                     System.out.println("____________________________________");
                                                                                     System.out.println("your take amount of Rp "+penarikan3);
                                                                                     System.out.println("your burst is Rp "+saldo);
                                                                                     System.out.println("");
                                                                                     status = true;
                                                                         }
                                                             else if ( tarik ==4){
                                                                                     saldo = (akun1 -penarikan4);
                                                                                     System.out.println("wait......");
                                                                                     System.out.println("____________________________________");
                                                                                     System.out.println("your take amount of Rp "+penarikan4);
                                                                                     System.out.println("your burst is Rp "+saldo);
                                                                                     System.out.println("");
                                                                                     status = true;
                                                                         }
                                                             else{
                                                                         System.out.println("kesalahan input kode");   
                                                                                    status=true;
                                                                                    break;

Listing ini digunakan untuk memberikan pilihan kepada user untuk menentukan tujuannya menggunakan mesin atm. Percabangan if kami gunakan karena if mudah dipakai dan cepat dimengerti oleh kami.
Penggunaan status = false ditiap akhir listing bertujuan untuk mengulang kembali program yang digunakan oleh user.
Penggunaan dua bahasa sebenarnya hanya berkutat pada system printnya,









PENUTUP
demikian lah program yang kami buat yang terdiri dari flowchart, pseudocode, dan koding program atm ini.
semoga bermanfaat bagi brother-sister yang mengunjungi blog kami.

jangan sampai meninggalkan blog ini,sebelum mendapatkan hal yang baru yang dapat mengantarkan anda menjadi seorang proggamer. 






Tidak ada komentar:

Posting Komentar