Posted by : Unknown Minggu, 16 Oktober 2016

Fuad Mahmud Ibrahim 22115793 2KB01
Ilham Hafizh Wanditama 23115278 2KB01
Febriyanto 22115597 2KB01

Berikut ini adalah program sederhana ATM dengan menggunakan bahasa pemrograman JAVA.

Kodingannya seperti ini:
mport java.util.Scanner;

/**
 *
 * @author ASUS
 */
public class ATM {
    String pin  ;
    int saldo, penarikan, jum_transfer, no_rekening,
            transfer,nominal_transfer, nominal_penarikan,
            cek_saldo_transfer, saldo_setelah_transfer, sisa_saldo;
     
    void cekRekening(){
        System.out.println("No rekening: " +no_rekening);
    }
    void cekSaldo(){
        System.out.println("Saldo: " +saldo);
    }
    void cekJumTransfer(){
        Scanner input1 = new Scanner(System.in);
        System.out.print("Jumlah Transfer= ");
        jum_transfer = input1.nextInt();
    }
    void cekNominalTransfer(){
        System.out.println("Nominal Transfer: " +jum_transfer);
    }
    void cekPenarikan(){
        System.out.println("Jumlah Penarikan: " +penarikan);
    }
    void cekNominalPenarikan(){
        System.out.println("Nominal Penarikan: " +nominal_penarikan);
    }
    void cekSaldoTransfer(){
        System.out.println("Sisa saldo Setelah Transfer : "
                +(saldo_setelah_transfer = (saldo - transfer)));
 
    }
    void cekSisaSaldo(){
        System.out.println("Sisa saldo: " +sisa_saldo
        +(sisa_saldo = (saldo - jum_transfer)));
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Pin= ");
        int pin = input.nextInt();
        ATM atm = new ATM();
        atm.no_rekening = 987654321;
        atm.saldo = 2500000;
        atm.cekRekening();
        atm.cekSaldo();
        atm.cekJumTransfer();
        atm.cekNominalTransfer();
        atm.cekPenarikan();
        atm.cekNominalPenarikan();
        atm.cekSaldoTransfer();
        atm.cekSisaSaldo();
    }
 
}

Hasil dari program tersebut:













Class pada program tersebut:
public class ATM 

Attribut pada program tersebut:
String pin  ;
    int saldo, penarikan, jum_transfer, no_rekening,
            transfer,nominal_transfer, nominal_penarikan,
            cek_saldo_transfer, saldo_setelah_transfer, sisa_saldo;

Metode pada program tersebut:
Scanner input = new Scanner(System.in);
        System.out.print("Pin= ");
        int pin = input.nextInt();
        ATM atm = new ATM();
        atm.no_rekening = 987654321;
        atm.saldo = 2500000;
        atm.cekRekening();
        atm.cekSaldo();
        atm.cekJumTransfer();
        atm.cekNominalTransfer();
        atm.cekPenarikan();
        atm.cekNominalPenarikan();
        atm.cekSaldoTransfer();
        atm.cekSisaSaldo();

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Time

Labels

Diberdayakan oleh Blogger.

Sign by Danasoft - Get Your Sign

Copyright © Fuad's Blog -Black Rock Shooter- Powered by Blogger - Designed by Johanes Djogan