Untitled
unknown
plain_text
2 years ago
9.2 kB
20
Indexable
Never
#include "String.h" #include "Bank.h" #include <iostream> void printMenu(); void printEditCustomerOptions(); void checkingEditCustomer(); void printEditAccountOptions(); void checkingEditAccount(); void checkingEditChoice(); void start() { //Bank bank("Allianz", "Vratsa"); int choice; printMenu(); std::cin >> choice; do { system("CLS"); switch (choice) { case 1: checkingEditChoice(); break; case 2: checkingListChoice(); break; case 3: checkingActionsChoice(); break; case 4: printBankInfo(); break; case 5: quit(); break; default: wrongChoice(); break; } } while (choice != 1 && choice != 2 && choice != 3 && choice != 4 && choice != 5); } //---------------------- void printMenu() { std::cout << "\t\t----------- WELCOME -----------\t\t" << std::endl; std::cout << "\t\t------- to the main page ------\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t 1. Edit (add/delete)\t\t" << std::endl; std::cout << "\t\t 2. List\t\t" << std::endl; std::cout << "\t\t 3. Action\t\t" << std::endl; std::cout << "\t\t 4. Display info for the bank\t\t" << std::endl; std::cout << "\t\t 5. Exit\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void printEditCustomerOptions() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Now, choose what to edit: \t\t" << std::endl; std::cout << "\t\t a. Add new customer\t\t" << std::endl; std::cout << "\t\t b. Delete customer\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void checkingEditCustomer() { char choice; do { printEditCustomerOptions(); std::cin >> choice; system("CLS"); if (choice == 'a') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to add new customer.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; //addCustomer(); } else if (choice == 'b') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to delete customer.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; //deleteCustomer(); } else { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Error! Try again!\t\t" << std::endl; } } while (choice != 'a' && choice != 'b'); } void printEditAccountOptions() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Now, choose what to edit: \t\t" << std::endl; std::cout << "\t\t a. Add new account\t\t" << std::endl; std::cout << "\t\t b. Delete account\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void checkingEditAccount() { char choice; do { printEditAccountOptions(); std::cin >> choice; system("CLS"); if (choice == 'a') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to add new account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else if (choice == 'b') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to delete account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Error! Try again!\t\t" << std::endl; } } while (choice != 'a' && choice != 'b'); } void printEditOptions() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Now, choose what to edit: \t\t" << std::endl; std::cout << "\t\t a. Customer\t\t" << std::endl; std::cout << "\t\t b. Account\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void checkingEditChoice() { char choice; do { printEditOptions(); std::cin >> choice; system("CLS"); if (choice == 'a') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to edit a customer.\t\t" << std::endl; checkingEditCustomer(); } else if (choice == 'b') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to edit an account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; checkingEditAccount(); } else { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Error! Try again!\t\t" << std::endl; } } while (choice != 'a' && choice != 'b'); } void printListOptions() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Now, choose what to list: \t\t" << std::endl; std::cout << "\t\t a. All customers\t\t" << std::endl; std::cout << "\t\t b. All accounts\t\t" << std::endl; std::cout << "\t\t c. Customer account\t\t" << std::endl; std::cout << "\t\t d. Log\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void checkingListChoice() { char choice; do { printListOptions(); std::cin >> choice; system("CLS"); if (choice == 'a') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to list all customers.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; //listCustomers(); } else if (choice == 'b') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to list all accounts.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else if (choice == 'c') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to list customer account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else if (choice == 'd') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to list log.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Error! Try again!\t\t" << std::endl; } } while (choice != 'a' && choice != 'b' && choice != 'c' && choice != 'd'); } void printActionsOptions() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Now, choose an action: \t\t" << std::endl; std::cout << "\t\t a. Withdraw from account\t\t" << std::endl; std::cout << "\t\t b. Deposit to account\t\t" << std::endl; std::cout << "\t\t c. Transfer\t\t" << std::endl; std::cout << std::endl; std::cout << "\t\t --> Your choice: "; } void checkingActionsChoice() { printActionsOptions(); char choice; do { std::cin >> choice; system("CLS"); if (choice == 'a') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to withdraw from account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else if (choice == 'b') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to deposit to account.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else if (choice == 'c') { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to transfer.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } else { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t Error! Try again!" << std::endl; } } while (choice != 'a' && choice != 'b' && choice != 'c'); } void printBankInfo() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to see the info for the bank.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; } void quit() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose to quit.\t\t" << std::endl; std::cout << "\t\t Goodbye! See you later! <3\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; return; } void wrongChoice() { std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; std::cout << "\t\t You chose wrong number.\t\t" << std::endl; std::cout << "\t\t-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\t\t" << std::endl; }