POS

mail@pastecode.io avatar
unknown
c_cpp
a month ago
28 kB
6
Indexable
Never
#include <iostream>
#include <string>

using namespace std;

/*
    >> JOBDESK MATERI <<
    HANS    (LINKEDLIST)
    MARIA   (STACK)
    AZKA    (LINEAR SEARCH)
    AYA     (QUEUE)
    IMAM    (ARRAY)
*/

// ~START_TASK:AYA
struct Item {
    int id;
    string name;
    float price;
    Item* next;
};
// END_TASK:AYA

struct Diskon {
    int id;
    float percentage;
};

struct Tax {
    int id;
    float percentage;
};

// ~START_TASK:AZKA
struct PaymentMethod {
    int id;
    string name;
    PaymentMethod* next;
};
// END_TASK:AZKA

// ~START_TASK:HANS
struct TransactionItem {
    Item* item;
    int quantity;
    TransactionItem* next;
};

struct Transaction {
    int invoice_id;
    TransactionItem* items;
    float total_price, tax_percentage, discount_percentage;
    Transaction* next;
};
// END_TASK:HANS

// TASK:MARIA
// struct buat simpan riwayat transaksi yang dihapus
struct StackNode {
    Transaction* transaction;
    StackNode* next, *top;
};

StackNode deletedTransactions = {nullptr};
// END_TASK:MARIA

// ~START_TASK:AYA
// queue buat manage item
struct QueueNode {
    Item* item;
    QueueNode* next;
};

struct Queue {
    QueueNode* front;
    QueueNode* rear;
};

Queue itemQueue = {nullptr, nullptr};

void enqueue(Queue& queue, Item* item) {
    QueueNode* newNode = new QueueNode{item, nullptr};
    if (!queue.front) {
        queue.front = queue.rear = newNode;
    } else {
        queue.rear->next = newNode;
        queue.rear = newNode;
    }
}

// otomatis hapus data paling awal
Item* dequeue(Queue& queue) {
    if (!queue.front) {
        return nullptr; // Queue kosong
    }
    QueueNode* temp = queue.front;
    Item* item = temp->item;
    queue.front = queue.front->next;
    if (!queue.front) {
        queue.rear = nullptr;
    }
    delete temp;
    return item;
}

// menampilkan semua item dalam queue
void displayQueue(const Queue& queue) {

    system("clear");    

    if (!queue.front) {
        cout << "Item kosong!\n"; // Queue Kosong
        return;
    }

    cout << "\n=========================\n";
    cout << "\tLIST ITEM";
    cout << "\n=========================\n\n";

    QueueNode* temp = queue.front;
    while (temp) {
        cout << " " << temp->item->id << ". " << temp->item->name << " (Rp. " << temp->item->price << ")" << "\n";
        temp = temp->next;
    }

    cout << "\n=========================\n\n";
}
// END_TASK:AYA

// ~START_TASK:HANS
// push transaksi ke stack
void push(StackNode& stack, Transaction* transaction) {
    StackNode* newNode = new StackNode;
    newNode->transaction = transaction;
    newNode->next = stack.top;
    stack.top = newNode;
}

// pop transaksi dari stack
Transaction* pop(StackNode& stack) {
    if (stack.top == nullptr) {
        return nullptr; // Stack kosong
    }
    StackNode* temp = stack.top;
    Transaction* transaction = temp->transaction;
    stack.top = stack.top->next;
    delete temp;
    return transaction;
}
// END_TASK:HANS


// ~START_TASK:IMAM
Diskon diskons[100];
Tax taxes[100];
// END_TASK:IMAM

// ~START_TASK:AYA
int itemCount = 0;
Item* items = nullptr;
// END_TASK:AYA

// ~START_TASK:
int diskonCount = 0;
int taxCount = 0;
// END_TASK:

// ~START_TASK:AZKA
PaymentMethod* paymentMethods = nullptr;
int paymentMethodCount = 0;
// END_TASK:AZKA

// ~START_TASK:HANS
Transaction* transactions = nullptr;
int transactionCount = 0;
// END_TASK:HANS

// ~START_TASK:AYA
void addItem(int id, const string& name, float price) {
    Item* newItem = new Item{id, name, price, nullptr};
    
    // enqueue item ke dalam antrian
    enqueue(itemQueue, newItem);

    // tambahkan item ke dalam list item
    if (!items) {
        items = newItem;
    } else {
        Item* temp = items;
        while (temp->next) {
            temp = temp->next;
        }
        temp->next = newItem;
    }
}
// END_TASK:AYA

// ~START_TASK:AZKA
void addPaymentMethod(int id, const string& name) {
    PaymentMethod* newMethod = new PaymentMethod;
    newMethod->id  = id;
    newMethod->name = name;
    newMethod->next = nullptr;

    if (!paymentMethods) {
        paymentMethods = newMethod;
    } else {
        PaymentMethod* temp = paymentMethods;
        while (temp->next) {
            temp = temp->next;
        }
        temp->next = newMethod;
    }

    paymentMethodCount++;
}
// END_TASK:AZKA

// ~START_TASK:HANS
void addTransaction(int invoice_id, TransactionItem* items, float total_price, float tax_percentage, float discount_percentage) {
    Transaction* newTransaction = new Transaction;
    newTransaction->invoice_id = invoice_id;
    newTransaction->items = items;
    newTransaction->total_price = total_price;
    newTransaction->tax_percentage = tax_percentage;
    newTransaction->discount_percentage = discount_percentage;
    newTransaction->next = nullptr;

    if (!transactions) {
        transactions = newTransaction;
    } else {
        Transaction* temp = transactions;
        while (temp->next) {
            temp = temp->next;
        }
        temp->next = newTransaction;
    }

    transactionCount++;
}

void deleteTransaction(int invoice_id) {
    if (!transactions) {
        cout << "Tidak ada transaksi yang bisa dihapus.\n";
        return;
    }

    Transaction* temp = transactions;
    Transaction* prev = nullptr;

    while (temp && temp->invoice_id != invoice_id) {
        prev = temp;
        temp = temp->next;
    }

    if (!temp) {
        cout << "Transaksi dengan invoice id " << invoice_id << " tidak ditemukan.\n";
        return;
    }

    if (!prev) {
        transactions = temp->next;
    } else {
        prev->next = temp->next;
    }

    push(deletedTransactions, temp);
    transactionCount--;

    cout << "Transaksi dengan invoice id " << invoice_id << " berhasil dihapus.\n"; // setelah dihapus invoice disimpan di stack
}
// END_TASK:HANS

// ~START_TASK:AZKA
Transaction* linearSearchTransaction(int invoice_id) {
    Transaction* temp = transactions;
    while (temp != nullptr) {
        if (temp->invoice_id == invoice_id) {
            return temp;
        }
        temp = temp->next;
    }
    return nullptr;
}

void searchTransaction() {
    if (!transactions) {
        system("clear");
        cout << "Belum ada transaksi!\n";
        return;
    }

    int invoice_id;
    cout << "\nMasukkan Invoice: ";
    cin >> invoice_id;

    system("clear");

    Transaction* result = linearSearchTransaction(invoice_id);
    if (result) {
        cout << "\n==================================\n";
        cout << "\tDETAIL TRANSAKSI";
        cout << "\n==================================\n\n";
        TransactionItem* temp = result->items;
        float subtotal = 0.0;

        while (temp) {
            cout << " Nama Item      : " << temp->item->name << "\n";
            cout << " Qty            : " << temp->quantity << "\n";
            float itemTotal = temp->item->price * temp->quantity;
            subtotal += itemTotal;
            cout << " Total Item     : Rp. " << itemTotal << "\n"; // Total harga untuk item ini

            temp = temp->next;
        }

        float taxAmount = subtotal * (result->tax_percentage / 100);
        float discountAmount = subtotal * (result->discount_percentage / 100);
        float total = subtotal + taxAmount - discountAmount;

        cout << " Subtotal       : Rp. " << subtotal << "\n";
        cout << " Tax (" << result->tax_percentage << "%)      : Rp. " << taxAmount << "\n";
        cout << " Diskon (" << result->discount_percentage << "%)   : Rp. " << discountAmount << "\n";
        cout << " Total Harga    : Rp. " << total << "\n";

        cout << "\n==================================\n";

    } else {
        cout << "Transaksi dengan invoice id " << invoice_id << " tidak ditemukan!\n";
    }
}
// END_TASK:AZKA

// ~START_TASK:HANS
TransactionItem* addTransactionItem(Item* item, int quantity) {
    TransactionItem* newItem = new TransactionItem{item, quantity, nullptr};
    return newItem;
}

void transaksi() {
    if (!items) {
        cout << "Item masih kosong!\n";
        return;
    }

    TransactionItem* transactionItems = nullptr;
    TransactionItem* lastItem = nullptr;
    int itemId, qty;
    char choice;

    while (true) {
        cout << "\n=========================\n";
        cout << "\tLIST ITEM";
        cout << "\n=========================\n\n";
        Item* temp = items;
        while (temp) {
            cout << " " << temp->id << ". " << temp->name << " (Rp." << temp->price << ")" << "\n";
            temp = temp->next;
        }

        cout << "\nPilih item (ID): ";
        cin >> itemId;

        cout << "Masukkan QTY: ";
        cin >> qty;

        temp = items;
        while (temp && temp->id != itemId) {
            temp = temp->next;
        }

        if (temp) {
            TransactionItem* newItem = addTransactionItem(temp, qty);
            if (!transactionItems) {
                transactionItems = newItem;
                lastItem = newItem;
            } else {
                lastItem->next = newItem;
                lastItem = newItem;
            }
        }

        cout << "\nTambah item lagi? (y/n): ";
        cin >> choice;
        if (choice == 'n') break;
        system("clear");
    }

    system("clear");
    if (taxCount == 0) {
        cout << "Tax masih kosong!\n";
        return;
    }

    cout << "\n=========================\n";
    cout << "\tLIST TAX";
    cout << "\n=========================\n\n";
    for (int i = 0; i < taxCount; i++) {
        cout << " " << taxes[i].id << ". " << taxes[i].percentage << "%\n";
    }

    int taxId;
    cout << "\nPilih tax (ID): ";
    cin >> taxId;
    float taxPercentage = taxes[taxId - 1].percentage;

    cout << "\nApakah ada diskon? (y/n): ";
    cin >> choice;

    float discountPercentage = 0.0;
    if (choice == 'y') {

        system("clear");
        if (diskonCount == 0) {
            cout << "Diskon masih kosong!\n";
            return;
        }

        cout << "\n==========================\n";
        cout << "\tLIST DISKON";
        cout << "\n==========================\n\n";
        for (int i = 0; i < diskonCount; i++) {
            cout << " " << diskons[i].id << ". " << diskons[i].percentage << "%\n";
        }

        int diskonId;
        cout << "\nPilih diskon (ID): ";
        cin >> diskonId;
        discountPercentage = diskons[diskonId - 1].percentage;
    }

    system("clear");
    if (paymentMethodCount == 0) {
        cout << "Metode pembayaran masih kosong!\n";
        return;
    }

    cout << "\n========================================\n";
    cout << "\tLIST METODE PEMBAYARAN";
    cout << "\n========================================\n\n";
    PaymentMethod* tempMethod = paymentMethods;
    while (tempMethod) {
        cout << " " << tempMethod->id << ". " << tempMethod->name << "\n";
        tempMethod = tempMethod->next;
    }

    int paymentMethodId;
    cout << "\nPilih metode pembayaran (ID): ";
    cin >> paymentMethodId;

    system("clear");

    float subtotal = 0.0;
    TransactionItem* temp = transactionItems;
    while (temp) {
        subtotal += temp->item->price * temp->quantity;
        temp = temp->next;
    }
    float taxAmount = subtotal * taxPercentage / 100;
    float discountAmount = subtotal * discountPercentage / 100;
    float totalPrice = subtotal + taxAmount - discountAmount;

    cout << "\n==================================\n";
    cout << "\tDETAIL TRANSAKSI";
    cout << "\n==================================\n\n";
    temp = transactionItems;
    while (temp) {
        cout << " Nama Item          : " << temp->item->name << "\n";
        cout << " Qty                : " << temp->quantity << "\n";
        temp = temp->next;
    }
    cout << " Subtotal           : " << "Rp. " << subtotal << "\n";
    cout << " Tax                : " << "Rp. " << taxAmount << "\n";
    cout << " Total Harga        : " << "Rp. " << totalPrice << "\n";

    if (discountPercentage > 0.0) {
        cout << " Diskon             : " << "Rp. " << discountAmount << " (" << discountPercentage << "%)\n";
    }

    tempMethod = paymentMethods;
    while (tempMethod) {
        if (tempMethod->id == paymentMethodId) {
            cout << " Metode Pembayaran  : " << tempMethod->name << "\n";
            break;
        }
        tempMethod = tempMethod->next;
    }

    cout << "\n==================================\n";

    addTransaction(transactionCount + 1, transactionItems, totalPrice, taxPercentage, discountPercentage);

    cout << "\nBuat transaksi ulang? (y/n): ";
    cin >> choice;

    system("clear");

    if (choice == 'y') {
        transaksi();
    }
}

void riwayatTransaksi() {

    system("clear");
    if (!transactions) {
        cout << "Riwayat transaksi kosong!\n";
        return;
    }

    cout << "\n=================================\n";
    cout << "\tRIWAYAT TRANSAKSI";
    cout << "\n=================================\n\n";
    Transaction* temp = transactions;
    while (temp) {
        cout << "Invoice ID: " << temp->invoice_id << ", Total: Rp. " << temp->total_price << "\n";
        temp = temp->next;
    }

    char choice;
    cout << "\nCari transaksi berdasarkan invoice? (y/n): ";
    cin >> choice;
    if (choice == 'y') {
        searchTransaction();
    }

    // ~START_TASK:MARIA
    cout << "\nHapus transaksi berdasarkan invoice? (y/n): ";
    cin >> choice;
    if (choice == 'y') {
        int invoice_id;
        cout << "Masukkan Invoice ID yang ingin dihapus: ";
        cin >> invoice_id;

        system("clear");
        deleteTransaction(invoice_id);
    }

    cout << "\nLihat transaksi yang dihapus? (y/n): ";
    cin >> choice;

    system("clear");

    if (choice == 'y') {

        Transaction* deletedTransaction = pop(deletedTransactions);
        if (deletedTransaction) {
            cout << "\n==================================\n";
            cout << "\tTRANSAKSI YANG DIHAPUS";
            cout << "\n==================================\n\n";
            TransactionItem* temp = deletedTransaction->items;
            while (temp) {
                cout << "Nama Item  : " << temp->item->name << "\n";
                cout << "Qty        : " << temp->quantity << "\n";
                temp = temp->next;
            }
            cout << "Total      : Rp. " << deletedTransaction->total_price << "\n";
            cout << "\n==================================\n\n";

        } else {
            cout << "Tidak ada transaksi yang dihapus.\n";
        }
    }
    // END_TASK:MARIA
}
// END_TASK:HANS

// ~START_TASK:AYA
void manageItem() {
    int choice;
    while (true) {
        cout << "\n===================================\n";
        cout << "\tMANAGE ITEM MENU";
        cout << "\n===================================\n\n";
        cout << " 1. List Item\n";
        cout << " 2. Add Item\n";
        cout << " 3. Edit Item\n";
        cout << " 4. Remove Item\n";
        cout << " 5. Keluar\n";
        cout << "\nPilih menu: ";
        cin >> choice;

        system("clear");

        switch (choice) {
            case 1:
                displayQueue(itemQueue);
                char c;
                cout << "Masukkan apapun untuk keluar : ";
                cin >> c;

                system("clear");
                break;
            
            case 2: {
                int id;
                string name;
                float price;
                cout << "Masukkan ID: ";
                cin >> id;
                cout << "Masukkan Nama: ";
                cin.ignore();
                getline(cin, name);
                cout << "Masukkan Harga: ";
                cin >> price;

                system("clear");

                addItem(id, name, price); // pake enqueue
                cout << "Item berhasil ditambahkan.\n";
                break;
            }

            case 3: {
                if (!items) {
                    cout << "Item masih kosong!\n";
                } else {
                    int id;
                    cout << "Masukkan ID item yang ingin diedit: ";
                    cin >> id;
                    Item* temp = items;
                    while (temp && temp->id != id) {
                        temp = temp->next;
                    }
                    if (temp) {
                        string name;
                        float price;
                        cout << "Masukkan Nama baru: ";
                        cin.ignore();
                        getline(cin, name);
                        cout << "Masukkan Harga baru: ";
                        cin >> price;
                        temp->name = name;
                        temp->price = price;

                        system("clear");
                        cout << "Item berhasil diedit.\n";
                    } else {
                        cout << "Item tidak ditemukan.\n";
                    }
                }
                break;
            }
            
            case 4: {
                Item* item = dequeue(itemQueue);
                if (item) {
                    cout << "Item dengan ID " << item->id << " telah didequeue.\n";
                    delete item;
                } else {
                    cout << "Queue kosong!\n";
                }
                break;
            }
            case 5:
                system("clear");
                return;
            default:
                cout << "Pilihan tidak valid.\n";
                break;
        }
    }
}
// END_TASK:AYA

// ~START_TASK:MARIA
void manageDiskon() {
    int choice;
    while (true) {
        cout << "\n===================================\n";
        cout << "\tMANAGE DISKON MENU";
        cout << "\n===================================\n\n";
        cout << " 1. List Diskon\n";
        cout << " 2. Add Diskon\n";
        cout << " 3. Edit Diskon\n";
        cout << " 4. Keluar\n";
        cout << "\nPilih menu: ";
        cin >> choice;

        system("clear");

        switch (choice) {
            case 1:
                if (diskonCount == 0) {
                    cout << "Diskon masih kosong!\n";
                } else {
                    cout << "\n==========================\n";
                    cout << "\tLIST DISKON";
                    cout << "\n==========================\n\n";
                    for (int i = 0; i < diskonCount; i++) {
                        cout << " " << diskons[i].id << ". " << diskons[i].percentage << "%\n";
                    }
                    cout << "\n==========================\n\n";

                    char c;
                    cout << "Masukkan apapun untuk keluar : ";
                    cin >> c;

                    system("clear");
                }
                break;
            case 2: {
                int id;
                float percentage;
                cout << "Masukkan ID: ";
                cin >> id;
                cout << "Masukkan Persentase Diskon: ";
                cin >> percentage;
                diskons[diskonCount++] = {id, percentage};
                cout << "Diskon berhasil ditambahkan.\n";
                break;
            }
            case 3: {
                if (diskonCount == 0) {
                    cout << "Diskon masih kosong!\n";
                } else {
                    int id;
                    cout << "Masukkan ID diskon yang ingin diedit: ";
                    cin >> id;
                    bool found = false;
                    for (int i = 0; i < diskonCount; i++) {
                        if (diskons[i].id == id) {
                            float percentage;
                            cout << "Masukkan Persentase Diskon baru: ";
                            cin >> percentage;
                            diskons[i].percentage = percentage;
                            found = true;
                            cout << "Diskon berhasil diedit.\n";
                            break;
                        }
                    }
                    if (!found) {
                        cout << "Diskon tidak ditemukan.\n";
                    }
                }
                break;
            }
            case 4:
                return;
            default:
                cout << "Pilihan tidak valid.\n";
                break;
        }
    }
}
// END_TASK:HANS

// ~START_TASK:HANS
void manageTax() {
    int choice;
    while (true) {
        cout << "\n=========================\n";
        cout << "\tMANAGE TAX MENU";
        cout << "\n=========================\n\n";
        cout << " 1. List Tax\n";
        cout << " 2. Add Tax\n";
        cout << " 3. Edit Tax\n";
        cout << " 4. Keluar\n";
        cout << "\nPilih menu: ";
        cin >> choice;

        system("clear");

        switch (choice) {
            case 1:
                if (taxCount == 0) {
                    cout << "Tax masih kosong!\n";
                } else {
                    cout << "\n=========================\n";
                    cout << "\tLIST TAX";
                    cout << "\n=========================\n\n";
                    for (int i = 0; i < taxCount; i++) {
                        cout << " " << taxes[i].id << ". " << taxes[i].percentage << "%\n";
                    }
                    cout << "\n=========================\n\n";

                    char c;
                    cout << "Masukkan apapun untuk keluar : ";
                    cin >> c;

                    system("clear");
                }
                break;
            case 2: {
                int id;
                float percentage;
                cout << "Masukkan ID: ";
                cin >> id;
                cout << "Masukkan Persentase Tax: ";
                cin >> percentage;
                taxes[taxCount++] = {id, percentage};
                cout << "Tax berhasil ditambahkan.\n";
                break;
            }
            case 3: {
                if (taxCount == 0) {
                    cout << "Tax masih kosong!\n";
                } else {
                    int id;
                    cout << "Masukkan ID tax yang ingin diedit: ";
                    cin >> id;
                    bool found = false;
                    for (int i = 0; i < taxCount; i++) {
                        if (taxes[i].id == id) {
                            float percentage;
                            cout << "Masukkan Persentase Tax baru: ";
                            cin >> percentage;
                            taxes[i].percentage = percentage;
                            found = true;
                            cout << "Tax berhasil diedit.\n";
                            break;
                        }
                    }
                    if (!found) {
                        cout << "Tax tidak ditemukan.\n";
                    }
                }
                break;
            }
            case 4:
                return;
            default:
                cout << "Pilihan tidak valid.\n";
                break;
        }
    }
}
// END_TASK:HANS

// ~START_TASK:AZKA
void managePaymentMethod() {
    int choice;
    while (true) {
        cout << "\n==============================================\n";
        cout << "\tMENU MANAGE PAYMENT METHOD";
        cout << "\n==============================================\n\n";
        cout << " 1. List Payment Method\n";
        cout << " 2. Add Payment Method\n";
        cout << " 3. Edit Payment Method\n";
        cout << " 4. Keluar\n";
        cout << "\nPilih menu: ";
        cin >> choice;
        
        system("clear");

        switch (choice) {
            case 1:
                if (paymentMethodCount == 0) {
                    cout << "Belum ada metode pembayaran tersedia.\n";
                } else {
                    cout << "\n========================================\n";
                    cout << "\tLIST PAYMENT METHOD";
                    cout << "\n========================================\n\n";
                    PaymentMethod* temp = paymentMethods;
                    while (temp) {
                        cout << " " << temp->id << ". " << temp->name << "\n";
                        temp = temp->next;
                    }
                    
                    cout << "\n========================================\n\n";
                    
                    char c;
                    cout << "Masukkan apapun untuk keluar : ";
                    cin >> c;

                    system("clear");
                }
                break;
            case 2: {
                int id;
                string name;
                cout << "Masukkan ID Payment Method: ";
                cin >> id;
                cout << "Masukkan Nama Payment Method: ";
                cin.ignore();
                getline(cin, name);
                addPaymentMethod(id, name);
                cout << "Payment Method berhasil ditambahkan.\n";
                break;
            }
            case 3: {
                if (paymentMethodCount == 0) {
                    cout << "Belum ada metode pembayaran tersedia untuk diedit.\n";
                } else {
                    int id;
                    string newName;
                    cout << "Masukkan ID Payment Method yang akan diedit: ";
                    cin >> id;
                    cout << "Masukkan Nama Payment Method baru: ";
                    cin.ignore();
                    getline(cin, newName);
                    bool found = false;
                    PaymentMethod* temp = paymentMethods;
                    while (temp) {
                        if (temp->id == id) {
                            temp->name = newName;
                            found = true;
                            cout << "Payment Method berhasil diedit.\n";
                            break;
                        }
                        temp = temp->next;
                    }
                    if (!found) {
                        cout << "Payment Method dengan ID " << id << " tidak ditemukan.\n";
                    }
                }
                break;
            }
            case 4: 
                return;
            default:
                cout << "Pilihan tidak valid.\n";
                break;
        }
    }
}
// END_TASK:AZKA

// ~START_TASK:IMAM
void addDefaultData() {
    addItem(1, "Katsu", 10000);
    addItem(2, "Fried Rice", 20000);
    addItem(3, "Chicken", 15000);

    taxes[0] = {1, 10.0};
    taxes[1] = {2, 5.0};
    taxCount = 2;

    diskons[0] = {1, 10.0};
    diskons[1] = {2, 20.0};
    diskonCount = 2;

    addPaymentMethod(1, "Cash");
    addPaymentMethod(2, "BCA");
    addPaymentMethod(3, "BNI");
}
// END_TASK:IMAM

// ~START_TASK:AZKA
int main() {

    addDefaultData();

    int choice;
    while (true) {
        cout << "\n===========================\n";
        cout << "\n>>>>>> POINT OF SALE <<<<<<\n";
        cout << "\n===========================\n\n";
        cout << " 1. Transaksi\n";
        cout << " 2. Riwayat Transaksi\n";
        cout << " 3. Manage Item\n";
        cout << " 4. Manage Diskon\n";
        cout << " 5. Manage Tax\n";
        cout << " 6. Manage Metode Pembayaran\n";
        cout << " 7. Exit\n";
        cout << "\nPilih menu: ";
        cin >> choice;

        system("clear");
        switch (choice) {
            case 1:
                transaksi();
                break;
            case 2:
                riwayatTransaksi();
                break;
            case 3:
                manageItem();
                break;
            case 4:
                manageDiskon();
                break;
            case 5:
                manageTax();
                break;
            case 6:
                managePaymentMethod();
                break;
            case 7:
                cout << "Terima kasih telah menggunakan program ini.\n";
                return 0;
            default:
                cout << "Pilihan tidak valid.\n";
                break;
        }
    }

    return 0;
}
// END_TASK:AZKA
Leave a Comment