2025-05-26 09:40:01 +00:00
|
|
|
#include <iostream>
|
2025-05-28 08:54:22 +00:00
|
|
|
#include <cctype>
|
|
|
|
#include "AtmAdmin.h"
|
2025-06-13 09:15:55 +00:00
|
|
|
#include "XMLStorage.h"
|
2025-05-28 08:54:22 +00:00
|
|
|
|
2025-06-11 08:52:02 +00:00
|
|
|
char startup() {
|
|
|
|
char choice{};
|
|
|
|
std::cout << "1. Change PIN\n" << "2. Change account name\n" << "3. Change money (UNFINISHED)\n" << "Q. Exit the program\n\n";
|
|
|
|
std::cout << ">: ";
|
2025-05-28 10:33:11 +00:00
|
|
|
|
2025-06-11 08:52:02 +00:00
|
|
|
std::cin >> choice;
|
2025-05-28 09:14:16 +00:00
|
|
|
|
2025-06-11 08:52:02 +00:00
|
|
|
return choice;
|
|
|
|
}
|
2025-05-26 09:40:01 +00:00
|
|
|
|
2025-06-13 09:15:55 +00:00
|
|
|
int main(int argc, [[maybe_unused]] char** argv) {
|
|
|
|
AtmAdmin::handleInvalidArguments(argc);
|
|
|
|
|
|
|
|
AtmAdmin::XMLStorage mainStorage{argv[1]};
|
2025-05-28 08:54:22 +00:00
|
|
|
bool continueLoop{true};
|
|
|
|
|
|
|
|
while (continueLoop) {
|
2025-06-11 08:45:36 +00:00
|
|
|
// startup() presents the user with the choices below.
|
2025-05-28 08:54:22 +00:00
|
|
|
// The other functions should handle invalid choices.
|
|
|
|
// ((1. Change pin || 2. Change money || 3. Change account name || Q. Exit the program))
|
2025-06-13 07:59:22 +00:00
|
|
|
char userChoice{startup()};
|
2025-05-28 08:54:22 +00:00
|
|
|
|
2025-06-11 08:45:36 +00:00
|
|
|
// The bulk of the program, allowing user to interact with the program.
|
|
|
|
// Always returns true unless 'Q' is entered.
|
2025-06-13 10:35:54 +00:00
|
|
|
continueLoop = AtmAdmin::handleUserInformation(static_cast<char>(std::tolower(userChoice)), mainStorage);
|
2025-05-28 08:54:22 +00:00
|
|
|
|
2025-06-13 10:35:54 +00:00
|
|
|
std::cout << "PIN: " << mainStorage.pin << " || NAME: " << mainStorage.name << " || MONEY: " << mainStorage.money << '\n'; // DEBUG
|
2025-05-28 08:54:22 +00:00
|
|
|
}
|
2025-05-26 09:40:01 +00:00
|
|
|
}
|