ETS - 2 - PBO (part 2)
3. Implementasikan rancangan Class dengan menggunakan bahasa pemrograman Java
Source Code:
atmMain.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
/** | |
* Write a description of class atmMain here. | |
* | |
* @author Aji Rindra Fakhrezi Putra Faisal | |
* @version 1.0.0 | |
*/ | |
public class atmMain | |
{ | |
public static void main(String[] args){ | |
mainMenuOption(); | |
} | |
public static void mainMenuOption(){ | |
Scanner scan = new Scanner(System.in); | |
int idAccount,pinAccount; | |
int menu; | |
System.out.println("======================================="); | |
System.out.println("Selamat datang di bank ITS"); | |
System.out.println("======================================="); | |
System.out.println("Masukkan ID bank rekening anda :"); | |
idAccount = scan.nextInt(); | |
System.out.println("Masukkan PIN bank rekening anda :"); | |
pinAccount = scan.nextInt(); | |
Account recentAccount = new Account(idAccount,pinAccount,"",0); | |
recentAccount.peopleAccount(idAccount,pinAccount); | |
while(true){ | |
System.out.println("Masukkan Command untuk melakukan transaksi yang diinginkan\n"); | |
System.out.println("1. Setoran Tunai\n"); | |
System.out.println("2. Penarikan Tunai\n"); | |
System.out.println("3. Selesai\n"); | |
menu = scan.nextInt(); | |
switch(menu){ | |
case 1: | |
System.out.println("Masukkan nominal uang yang akan di setor:"); | |
double money = scan.nextDouble(); | |
int choise1, choise2; | |
depositMoney recentMoney = new depositMoney(money,recentAccount.getaccountID(),recentAccount.getPIN(), | |
recentAccount.getName(), recentAccount.getBalance()); | |
System.out.println("Total uang yang diterima: Rp"+recentMoney.getinitialMoney()); | |
System.out.println("1. Setor\n"); | |
System.out.println("2. Batal\n"); | |
choise1 = scan.nextInt(); | |
switch(choise1){ | |
case 1: | |
System.out.println("Setoran ke:\n"); | |
System.out.println("1. Rekening Anda\n"); | |
System.out.println("2. Rekening lain\n"); | |
choise2 = scan.nextInt(); | |
switch(choise2){ | |
case 1: | |
recentMoney.insertMoney(); | |
recentMoney.printreceiptownAccount(); | |
break; | |
case 2: | |
System.out.print("Maaf pelayanan ini belum bisa diakses"); | |
break; | |
} | |
} | |
break; | |
case 2: | |
withdrawMoney recentwithdrawMoney = new withdrawMoney(); | |
break; | |
case 3: | |
System.out.println("Terima Kasih telah menggunakan pelayanan kami"); | |
System.exit(0); | |
} | |
} | |
} | |
} |
withdrawMoney.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class withdrawMoney here. | |
* | |
* @author Aji Rindra Fakhrezi Putra Faisal | |
* @version 1.0.0 | |
*/ | |
public class withdrawMoney | |
{ | |
public withdrawMoney(){ | |
System.out.println("Maaf untuk layanan transaksi ini masih dalam perbaikan\n"); | |
} | |
} |
depositMoney.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class depositMoney here. | |
* | |
* @author Aji Rindra Fakhrezi Putra Faisal | |
* @version 1.0.0 | |
*/ | |
public class depositMoney extends Account | |
{ | |
private double initialMoney; | |
private int idAcc; | |
private int pinAcc; | |
public void getaccountInfo(int idAcc, int pinAcc){ | |
idAcc = idAcc; | |
pinAcc = pinAcc; | |
} | |
public depositMoney(double initialMoney,int accountID, int PIN, String Name, double balance){ | |
super(accountID, PIN, Name, balance); | |
this.initialMoney = initialMoney; | |
} | |
public double getinitialMoney(){ | |
return initialMoney; | |
} | |
public double insertMoney(){ | |
return getBalance() + this.initialMoney; | |
} | |
public void printreceiptownAccount(){ | |
peopleAccount(idAcc,pinAcc); | |
System.out.println("========================================================"); | |
System.out.println("Nama :"+getName()); | |
System.out.println("ID :"+getaccountID()); | |
System.out.println("Jumlah yang disetor :"+initialMoney); | |
System.out.println("Saldo :"+insertMoney()); | |
System.out.println("========================================================"); | |
} | |
} |
Account.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Write a description of class Account here. | |
* | |
* @author Aji Rindra Fakhrezi Putra Faisal | |
* @version 1.0.0 | |
*/ | |
public class Account | |
{ | |
private String Name; | |
private int accountID; | |
private int PIN; | |
public double balance; | |
public Account(int accountID, int PIN, String Name, double balance){ | |
this.accountID = accountID; | |
this.PIN = PIN; | |
this.balance = balance; | |
this.Name = Name; | |
} | |
public void peopleAccount(int accountID, int PIN){ | |
if((accountID == 1)&&(PIN == 1234)){ | |
setName("Aji Rindra Fakhrezi Putra Faisal"); | |
this.balance = 200000; | |
} | |
else if((accountID==2)&&(PIN==2345)){ | |
setName("Bayu Adjie Sidharta"); | |
balance = 500000; | |
} | |
else if((accountID==2)&&(PIN==3456)){ | |
setName("Rayhani Juani Carlosni"); | |
balance = 1000000; | |
} | |
} | |
public int getaccountID(){ | |
return accountID; | |
} | |
public int getPIN(){ | |
return PIN; | |
} | |
public void setName(String Name){ | |
this.Name = Name; | |
} | |
public String getName(){ | |
return Name; | |
} | |
public void setBalance(double balanceNew){ | |
this.balance=balanceNew; | |
} | |
public double getBalance(){ | |
return balance; | |
} | |
public void insertMoney(double amount){ | |
balance = balance + amount; | |
} | |
} |
4. Buat Video demo yang menjelaskan pembuatan aplikasi tersebut beserta dengan hasil eksekusinya
Posting pada 25 Novermber 2020, Pukul 02.15 WITA / 01.15 WIB
Comments
Post a Comment