0% found this document useful (0 votes)
23 views

Cout Jmluang Cashdispenser Cashdispenser + Jmluang

This C++ program defines an ATM cash dispenser simulation with the following functionality: 1) It prompts the user to enter their PIN and checks if it is valid before continuing. 2) It displays a menu for the user to deposit money, withdraw money, or check the balance and prompts them to make a selection. 3) Based on the user's selection, it will either add money to the cash dispenser when depositing, dispense money when withdrawing if there are sufficient funds, or display the current balance. 4) It continues looping through the menu options until the user selects to finish the transaction.

Uploaded by

putrimeriyen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Cout Jmluang Cashdispenser Cashdispenser + Jmluang

This C++ program defines an ATM cash dispenser simulation with the following functionality: 1) It prompts the user to enter their PIN and checks if it is valid before continuing. 2) It displays a menu for the user to deposit money, withdraw money, or check the balance and prompts them to make a selection. 3) Based on the user's selection, it will either add money to the cash dispenser when depositing, dispense money when withdrawing if there are sufficient funds, or display the current balance. 4) It continues looping through the menu options until the user selects to finish the transaction.

Uploaded by

putrimeriyen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

// Nama :Putri Meriyen Budi.

S
// Program ATMSS
// Program ATM Super Sederhana (ATM-SS) milik BSSJ (Bank Super Sederhana Juga)
#include <iostream>
using namespace std;
int main () {
// KAMUS
char menu;
int pin;
int cashdispenser;
int jmluang;
// ALGORITMA
cout << "Selamat datang di Mesin ATM Bank Super Sederhana Juga" << endl;
cout << "Masukkan pin Anda : ";
cin >> pin;
if ((pin >= 101) && (pin <= 1000)){cashdispenser=0;
cout << "A atau a : Memasukkan uang ke cash dispenser" << endl;
cout << "B atau b : Menarik uang" << endl;
cout << "C atau c : Memeriksa sisa uang di cash dispenser" << endl;
cout << "X atau x : Selesai" << endl;
cout << "Silakan masukkan pilihan jenis transaksi = ";
cin >> menu;
while ((menu != 'X') && (menu != 'x')) {
switch (menu) {
case 'A' : cout << "Jumlah uang yang dimasukkan =Rp ";
cin >> jmluang;
cashdispenser = cashdispenser + jmluang;
cout << "Jumlah uang dalam cash dispenser = " << cashdispenser << endl;
break;
case 'a' : cout << "Jumlah uang yang dimasukkan =Rp ";
cin >> jmluang;
cashdispenser = cashdispenser + jmluang;
cout << "Jumlah uang dalam cash dispenser =Rp " << cashdispenser << endl;
break;
case 'B' : cout << "Jumlah uang yang ditarik = ";

cin >> jmluang;


if (cashdispenser - jmluang < 0) {
cout << "Jumlah penarikan terlalu besar" << endl;
cout << "Tidak bisa menarik uang " << cashdispenser << endl;
}
else ( cashdispenser-jmluang>=0) {
cout << "Silakan ambil uang sejumlah = " << jmluang << endl;
cout << "Jumlah uang dalam cash dispenser = " << cashdispenser << endl;}
break;
case 'b' : cout << "Jumlah uang yang ditarik = ";
cin >> jmluang;
if (cashdispenser - jmluang < 0) {
cout << "Jumlah penarikan terlalu besar" << endl;
cout << "Tidak Bisa menarik uang "<< endl;
} else (cashdispenser-jmluang >= 0){
cashdispenser = cashdispenser - jmluang;
cout << "Silakan ambil uang sejumlah = " << jmluang << endl;
cout << "Jumlah uang dalam cash dispenser = " << cashdispenser << endl;
}
break;
case 'C' : cout << "Jumlah uang dalam cash dispenser = " << cashdispenser << endl;
break;
case 'c' : cout << "Jumlah uang dalam cash dispenser = " << cashdispenser << endl;
break;
default : cout << "Bukan pilihan menu yang benar" << endl;
break;
}
// Tampilan Menu dan Input Menu
cout << "A atau a : Memasukkan uang ke cash dispenser" << endl;
cout << "B atau b : Menarik uang" << endl;
cout << "C atau c : Memeriksa sisa uang di cash dispenser" << endl;
cout << "X atau x : Selesai" << endl;
cout << "Silakan masukkan pilihan jenis transaksi = "; cin >> menu;
}
} else {
cout << "Unauthorized access!" << endl;
}
return 0;
}

// Keterangan :
// Bagian kode dengan warna yang sama adalah bagian kode yang sama teksnya

You might also like