Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 9

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <windows.h>
#include <conio.h>
#include <fstream>
#include <ctime>
using namespace std;

void waktu();

int pilihan[4];
char yt, ch;
string nm, nomor_hp;
int kategori, beli, jam, menit, detik, hari, bulan, tahun;
int i = 0;
int simpan[4];
int berat_total[4] = { 50,50,50,50 };
int wei[4];
string mesin[4] = { "Reguler ","Ekspress","Kilat ","Promo " };
string promo[4] = { "Paket Reguler Cuci 2 Hari ","Paket Ekspress Cuci 1
Hari","Paket Kilat Cuci 3 Jam ","Paket Cuci Promo " };
int harga[] = { 10000,15000,13000,9000 };
int bel[4];
int tot[4];
int cuan = 0;
int total_bayar, kembalian, berat = 0, total, total_semua = 0;

void orgdlm();

int main()
{

awal:
system("color F5");
system("cls");
//Judul Program
cout << endl;
cout << "
###################################################" << endl;
cout << " # ~~~~~~~~~~~~~
#" << endl;
cout << " #~~~~~~~~~~~~~~~~~ Laundry PUTRA
~~~~~~~~~~~~~~~~~#" << endl;
cout << " #
#" << endl;
cout << " #~~~~~~~~ bersih, rapih, wangi,
kinclong ~~~~~~~~~#" << endl;
cout << " #
#" << endl;
cout << " #~~~~~~~~~~~~~ ADNAN, WILLY, PUTRA
~~~~~~~~~~~~~~~#" << endl;
cout << " # ~~~~~~~~~~~~~~~~~~~
#" << endl;
cout << "
###################################################" << endl << endl;

//Data Customer
cout << " Data Customer
Laundry" << endl;
cout << "
----------------------------" << endl;
cout << " Nama Customer : "; cin
>> nm;

if (nm == "admin")
{
system("cls");
cout << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#" << endl;
cout << " # Administrasi Laundry
PUTRA #" << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#" << endl << endl;
string username, password;
login:
username = "";
password = "";
cout << " Masukkan username: ";
cin >> username;
cout << " Masukkan password: ";
ch = _getch();
while (ch != 13) { // 13 adalah kode ASCII untuk karakter Enter
password.push_back(ch); // Menambahkan karakter null pada akhir
password
cout << '*';
ch = _getch();
}

if (username == "admin" && password == "12345")


{
menuadmin:
int pilihan;
system("cls");
system("color E1");
cout << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ MENU ADMINISTRATOR
~~~~~~~~~~~~~~~# " << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " 1. Ganti Harga
" << endl;
cout << " 2. Lihat daftar Harga
" << endl;
cout << " 3. Ganti Kapasitas
Mesin " << endl;
cout << " 4. Lihat Kapasitas
Mesin " << endl;
cout << " 5. Kembali ke menu
utama " << endl;
cout << " cuan = Rp. " << cuan
<< endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~ ADNAN, WILLY, PUTRA
~~~~~~~~~~~~~~~# " << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " Pilihan Anda : ";
cin >> pilihan;
if (pilihan == 1)
{
menuganti:
int n, baru;
system("cls");
system("color E1");
cout << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ G A N T I H A R G A
~~~~~~~~~~~~~# " << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ 1. HARGA REGULER
~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ 2. HARGA EXPRESS
~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ 3. HARGA KILAT
~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ 4. HARGA PROMO
~~~~~~~~~~~~~# " << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " #~~~~~~~~~~~~~~ ADNAN, WILLY, PUTRA
~~~~~~~~~~~~~# " << endl;
cout << "
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~# " << endl;
cout << " PILIHAN ANDA : ";
cin >> n;
cout << " Masukan Harga Terbaru : ";
cin >> baru;
harga[n - 1] = baru;
cout << endl;
cout << " UPDATED!!!
" << endl;
cout << " Harga Terbaru adalah Rp
" << harga[n - 1] << endl;
cout << "
============================================= " << endl;
cout << endl;
cout << " Input Data Lagi (y/t) ? "; //mau
looping atau tidak
cin >> yt;
if (yt == 'Y' || yt == 'y')
{
goto menuganti;
}
if (yt == 'T' || yt == 't')
{
goto menuadmin;
}
}
if (pilihan == 2)
{
system("cls");
system("color E1");
cout << endl;
int a;
cout << " =========================================== " <<
endl;
cout << " = Daftar Harga = " <<
endl;
cout << " =========================================== " <<
endl;
for (a = 0; a < 4; a++)
{
cout << " " << promo[a] << " : Rp. " << harga[a] << endl;
}
cout << " =========================================== " <<
endl;
cout << endl;
cout << " Klik ENTER to Continue... " << endl;
cin.get();
cin.get();
goto menuadmin;
}
if (pilihan == 3)
{
system("cls");
int n, baru;
cout << " =========================================== " <<
endl;
cout << " Ganti Kapasitas Mesin " <<
endl;
cout << " ___________________________________________ " <<
endl;
cout << " No Jenis Mesin Kapasitas " <<
endl;
cout << " =========================================== " <<
endl;
for (int a = 0; a < 4; a++)
{
cout << " " << a + 1 << ". " << mesin[a] << "
" << berat_total[a] << " Kg " << endl;
}
cout << " =========================================== " <<
endl;
cout << " Pilihan Anda : ";
cin >> n;
cout << " Masukan Kapasitas Terbaru : ";
cin >> baru;
berat_total[n - 1] = baru;
cout << endl;
cout << " UPDATED!!! " <<
endl;
cout << " Kapasitas Terbaru adalah " << berat_total[n -
1] << " Kg" << endl;
cout << " ============================================= " <<
endl;
cout << endl;
cout << " Input Data Lagi (y/t) ? "; //mau looping
atau tidak
cin >> yt;
if (yt == 'Y' || yt == 'y')
{
goto menuganti;
}
if (yt == 'T' || yt == 't')
{
goto menuadmin;
}
}
if (pilihan == 4)
{
system("cls");
cout << " =========================================== " <<
endl;
cout << " Kapasitas Mesin " <<
endl;
cout << " ___________________________________________ " <<
endl;
cout << " Jenis Mesin Kapasitas " <<
endl;
cout << " =========================================== " <<
endl;
for (int a = 0; a < 4; a++)
{
cout << " " << mesin[a] << " " <<
berat_total[a] << " Kg " << endl;
}
cout << " =========================================== " <<
endl;
cout << endl;
cout << " Klik ENTER to Continue... " << endl;
cin.get();
cin.get();
goto menuadmin;
}
if (pilihan == 5)
{
nm = "";
goto awal;
}
else
{
cout << endl;
cout << " Salah Input /
Menu Tidak Tersedia";
Sleep(1500);
goto menuadmin;

}
}
else
{
cout << endl;
cout << "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
cout << " ~~~~~ Username /
Password Salah! ~~~~~" << endl;
cout << "
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << endl;
i = i + 1;
if (i < 4)
{
goto login;
}
else
{
cout << " ~~~~~~~Anda
Terblokir~~~~~~~";
cin.get();
cin.get();
goto awal;
}

}
}

cout << " No Handphone : "; cin


>> nomor_hp;
cout << "
---------------------------------" << endl;
for (int i = 0; i < 4; i++) {
bel[i] = 0;
simpan[i] = 0;
wei[i] = 0;
}
kategor:
//Pilih Kategori
cout << " Kategori Cucian"
<< endl;
cout << "
---------------------------------" << endl;
cout << " 1. Reguler (2 Hari)
Rp. " << harga[0] << endl;
cout << " 2. Ekspress (1 Hari)
Rp. " << harga[1] << endl;
cout << " 3. Kilat (3 Jam)
Rp. " << harga[2] << endl;
cout << " 4. Promo (2 Hari)
Rp. " << harga[3] << endl;
cout << " 5. Keluar
" << endl;
cout << "
---------------------------------" << endl;
cout << " Pilih No Kategori [1-5] :
"; cin >> kategori;

//Kondisi Switch Case


if (kategori == 1 || kategori == 2 || kategori == 3 || kategori == 4)
{
bel[kategori - 1] = kategori;
cout << " Berat Cucian (Kg)
: "; cin >> berat;
if (berat > berat_total[kategori-1])
{
cout << endl;
cout << " Maaf Menu Sudah
Tidak Tersedia" << endl;
cout << " Silahkan Pilih
Menu Lainnya" << endl;
Sleep(1500);
goto kategor;
}
else
{
tot[kategori - 1] = harga[kategori - 1] * berat;
berat_total[kategori - 1] = berat_total[kategori - 1] - berat;
simpan[kategori - 1] = simpan[kategori - 1] + tot[kategori - 1];
wei[kategori - 1] = wei[kategori - 1] + berat;
}
}
else if (kategori == 5)
{
goto akhir;
}
else {
cout << endl;
cout << " Salah Input / Menu
Tidak Tersedia";
Sleep(1500);
goto kategor;
}
cout << "
-----------------------------------------------------" << endl;
cout << " Tagihan Ditambahkan Ke Menu
Bayar" << endl;
cout << " Pilih Paket Lain (y/t) ?
"; cin >> yt;
if (yt == 'Y' || yt == 'y') {
goto kategor;
}
else {
goto bayar;
}
bayar:
system("cls");
//Result Pemesanan Jasa Laundry
cout << " Detail Pemesanan Berkah
Laundry " << endl;
cout << "
-----------------------------------------------------" << endl;
cout << " Nama Customer : " <<
nm << endl;
cout << " No. Handphone : " <<
nomor_hp << endl;

for (int pilihin = 0; pilihin < 4; pilihin++) {


if (bel[pilihin] != 0)
{
cout << " " << promo[pilihin] << " :
Rp. " << simpan[pilihin] << endl;
}
}
total_semua = simpan[0] + simpan[1] + simpan[2] + simpan[3];
//rumus perhitungan total
cout << " Total Harga : Rp. "
<< total_semua << endl;
cout << "
=====================================================" << endl;
cout << " Total Bayar : Rp.
"; cin >> total_bayar;

//rumus perhitungan kembalian


kembalian = total_bayar - total_semua;
if (total_bayar < total_semua)
{
cout << " :
Rp. " << kembalian << endl << endl;
cout << " T I D A K
" << endl;
cout << " B O L E H
" << endl;
cout << " H U T A N
G !!!" << endl;
int memilih;
cout << endl;
cout << " 1. Kembali ke kategori
cuci " << endl;
cout << " 2. Kembali ke pembayaran
" << endl;
cout << " 3. Exit " << endl;
cout << " Pilihan anda = ";
cin >> memilih;
if (memilih == 1)
{
goto kategor;
}
else if (memilih == 2)
{
goto bayar;
}
else if (memilih == 3)
{
goto akhir;
}
}
else
{
cuan = cuan + total_semua;
cout << " Kembalian :
Rp. " << kembalian << endl;
cout << "
=====================================================" << endl;
cout << "" << endl;
waktu();
ofstream myFile;
myFile.open("StrukPembayaran.txt", ios::trunc);
cout << " Mencetak Struk
Pembayaran " << endl << endl;
myFile << "====================================" << endl;
myFile << " Laundry PUTRA " << endl;
myFile << "====================================" << endl;
myFile << jam << " : " << menit << " : " << detik << endl;
myFile << hari << " - " << bulan << " - " << tahun << endl;
myFile << "Nama Customer : " << nm << endl;
myFile << "No. Customer : " << nomor_hp << endl;
myFile << "------------------------------------" << endl;
for (int pilihin = 0; pilihin < 4; pilihin++) {
if (bel[pilihin] != 0)
{
myFile << promo[pilihin] << " : " << harga[pilihin] << endl;
myFile << wei[pilihin] << " Kg X " << harga[pilihin] << "
" << total_semua << endl;
}
}
myFile << "------------------------------------" << endl << endl;
myFile << " Total " << total_semua << endl;
myFile << " Tunai " << total_bayar << endl;
myFile << "------------------------------------" << endl;
myFile << " Kembali " << kembalian << endl;
myFile << "------------------------------------" << endl;
myFile << " TERIMA KASIH " << endl;
myFile << " TELAH BERBELANJA " << endl;
myFile << " DI PUTRA LAUNDRY " << endl;
// menutup program
myFile.close();
}
cin.get();
cin.get();
goto awal;
akhir:
system("cls");
cout << "M E N U T U P P R O G R A M";
Sleep(500);
cout << ".";
Sleep(500);
cout << ".";
Sleep(500);
cout << ".";
Sleep(500);
return 0;
}

void waktu()
{
time_t ttime = time(0);
tm* local_time = localtime(&ttime);

jam = local_time->tm_hour;
menit = local_time->tm_min;
detik = local_time->tm_sec;
hari = local_time->tm_mday;
bulan = 1 + local_time->tm_mon;
tahun = 1900 + local_time->tm_year;
}

You might also like