diff --git a/README.md b/README.md index 9286f6c..194f2e4 100644 --- a/README.md +++ b/README.md @@ -1,110 +1,20 @@ -#### __* Work in progress__ +# Ticketing System +[![CircleCI](https://circleci.com/gh/binhonglee/TicketingSystem.svg?style=svg)](https://circleci.com/gh/binhonglee/TicketingSystem) [![Issue Count](https://codeclimate.com/github/binhonglee/TicketingSystem/badges/issue_count.svg)](https://codeclimate.com/github/binhonglee/TicketingSystem) + +An overall system that records information about each vehicles and users. + +For detailed API documentations, please visit https://binhonglee.github.io/TicketingSystem/docs/. + +## Setting up and running it + +```sh +$ git clone https://github.com/binhonglee/TicketingSystem.git +$ cd TicketingSystem +$ ant execute +``` ##### Disclaimer: This program is written solely on personal time with the purpose to pick up the C++ programming language once again after a long long time since I last wrote anything with it. The original version of this program (as seen in the initial commit) was a version of my work years ago. I decided that starting from scratch might not be the best idea when it comes to a programming language that I haven't use for a long time. However, as years pass, there are different things that I've learn from other programming languages that I thought would be fun to see how that implementation works with C++ so it will eventually be very much different from what it was. - -# Ticketing System - -Currently the program only works as a login system that keeps track of users and enable them to login and logout while updating their information. - -## Person.hpp / Person.cpp - -#### Constructors - -| Parameters | Task | -|:-----------|:-----------------------------| -| `()` | Empty constructor. | -| `(string newName, string newEmail, string newPhoneNo, string newPassword, int newId)` | Constructor with all parameters to populate all data slots in the object. | - -#### Functions - -| Function | Task | -|:----------------------|:-------------------------| -| `void setName(string);` | Set `name` to the new given input. | -| `string getName();` | Return `name` to caller. | -| `void setEmail(string);` | Set `email` to the new given input. | -| `string getEmail();` | Return `email` to caller. | -| `void setPhoneNo(string);` | Set `phoneNo` to the new given input. | -| `string getPhoneNo();` | Return `phoneNo` to caller. | -| `void setPassword(string);` | Set `password` to the new given input. | -| `string getPassword();` | Return `password` to the caller. | -| `bool checkPassword(string);` | Return if the given string matches `password`. | -| `int getId();` | Return `id` to the caller. | - -## LogInSystem.hpp / LogInSystem.cpp - -#### Constructors - -| Parameters | Task | -|:-----------|:-----------------------------------| -| `()` | Creates an empty `LogInSystem` with nothing in the `users` vector. | -| `(string filename)` | Initialize the `users` vector from the file of the given filename. | - -#### Functions - -| Function | Task | -|:----------------------|:-------------------------| -| `Person getUser(string);` | Takes in a string parameter that will be used to searched for a matching username in the users vector. | -| `Person getUser(int);` | Takes in an int parameter that will be used to searched for a matching id in the users vector. | -| `int login();` | Verify user credentials and return the user's id. | -| `void loggedIn(Person);` | Takes in a Person parameter after the user has logged in as that identity. It provides the user options to display and modify the information of that specific identity in the database (vector). | -| `Person registration();` | Request all the required information from the user to register for a new account and add them into the users vector. | -| `Person editCredentials(Person);` | Takes in a `Person` parameter and make edit to it according to the user's intention. It will then return the updated Person to the caller. | -| `void update(Person);` | Take in a `Person` parameter that is to be updated into the users vector. It will search for the `Person` in the vector with matching ID and replace it. | -| `string chgUsername();` | Changes the `username` of the `Person`. | -| `string chgPassword(Person);` | Changes the `password` of the `Person`. | -| `string chgEmail();` | Changes the `email` of the `Person`. | -| `string chgPhoneNo();` | Changes the `phoneNo` of the `Person`. - -## Vehicle.hpp / Vehicle.cpp - -#### Constructors - -| Parameters | Task | -|:-----------|:-----------------------------| -| `(int length, int width, int id)` | Basic constructor that fill in the rest of the missing information with "TBA". | -| `(string type, int length, int width, string origin, string destination, string dateNtime, int id)` | Complete constructor with all the information except the seatMap. | -| `(string type, int length, int width, string origin, string destination, string dateNtime, int id, vector< vector > seatMap)` | Complete constructor that is used to read data from the database. | - -#### Functions - -| Function | Task | -|:---------------------------|:-------------------------| -| `void setType(string type);` | Set `type` to the new given input. | -| `void setOrigin(string origin);` | Set `origin` to the new given input. | -| `void setDestination(string destination);` | Set `destination` to the new given input. | -| `void setDateNTime(string dateNtime);` | Set `dateNtime` to the new given input. | -| `string getType();` | Return `type` to the caller. | -| `int getLength();` | Return `length` to the caller. | -| `int getWidth();` | Return `width` to the caller. | -| `string getOrigin();` | Return `origin` to the caller. | -| `string getDestination();` | Return `destination` to the caller. | -| `string getDateNTime();` | Return `dateNtime` to the caller. | -| `int getId();` | Return `id` to the caller. | -| `void initialize();` | Initialize the `seatMap` to the intended size. | -| `bool bookSeat(int x, int y, int guestId);` | Register a specific seat to the given guestId. Returns if the proces is successful. | -| `bool checkAvailabilty(int x, int y);` | Check if the seat at the given coordinate is still available. | -| `void printMap();` | Print the map with label of 'A' as *available* and 'X' as *not available*. | -| `void printMap(int guestId);` | Takes in the user id and print the map with label of 'A' as *available*, 'U' as the *user* and 'X' as *not available*. | - -## VehicleManager.hpp / VehicleManager.cpp - -#### Constructors - -| Parameters | Task | -|:-----------|:--------------------------------| -| `()` | Empty constructor. Creates an empty vector of `vehicles`. | -| `(string jsonFile)` | Creates a vector of `vehicles` by importing the data from a json file. | - -#### Functions - -| Function | Task | -|:----------------------------------|:-------------------------| -| `bool add(Vehicle newVehicle);` | Add a new `Vehicle` into the vector. | -| `bool remove(Vehicle toRemove);` | Remove a specific `Vehicle` from the vector. | -| `Vehicle get(int id);` | Get a specific `Vehicle` with the given `id`. | -| `void toJson(string jsonFile);` | Export all data to a json file. | -| `int getId();` | Returns a suggested `id` for the next item. | diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..0b227dc --- /dev/null +++ b/docs/index.md @@ -0,0 +1,100 @@ +# Ticketing System + +## Person.hpp / Person.cpp + +#### Constructors + +| Parameters | Task | +|:-----------|:-----------------------------| +| `()` | Empty constructor. | +| `(string newName, string newEmail, string newPhoneNo, string newPassword, int newId)` | Constructor with all parameters to populate all data slots in the object. | + +#### Functions + +| Function | Task | +|:----------------------|:-------------------------| +| `void setName(string);` | Set `name` to the new given input. | +| `string getName();` | Return `name` to caller. | +| `void setEmail(string);` | Set `email` to the new given input. | +| `string getEmail();` | Return `email` to caller. | +| `void setPhoneNo(string);` | Set `phoneNo` to the new given input. | +| `string getPhoneNo();` | Return `phoneNo` to caller. | +| `void setPassword(string);` | Set `password` to the new given input. | +| `string getPassword();` | Return `password` to the caller. | +| `bool checkPassword(string);` | Return if the given string matches `password`. | +| `int getId();` | Return `id` to the caller. | + +## LogInSystem.hpp / LogInSystem.cpp + +#### Constructors + +| Parameters | Task | +|:-----------|:-----------------------------------| +| `()` | Creates an empty `LogInSystem` with nothing in the `users` vector. | +| `(string filename)` | Initialize the `users` vector from the file of the given filename. | + +#### Functions + +| Function | Task | +|:----------------------|:-------------------------| +| `Person getUser(string);` | Takes in a string parameter that will be used to searched for a matching username in the users vector. | +| `Person getUser(int);` | Takes in an int parameter that will be used to searched for a matching id in the users vector. | +| `int login();` | Verify user credentials and return the user's id. | +| `void loggedIn(Person);` | Takes in a Person parameter after the user has logged in as that identity. It provides the user options to display and modify the information of that specific identity in the database (vector). | +| `Person registration();` | Request all the required information from the user to register for a new account and add them into the users vector. | +| `Person editCredentials(Person);` | Takes in a `Person` parameter and make edit to it according to the user's intention. It will then return the updated Person to the caller. | +| `void update(Person);` | Take in a `Person` parameter that is to be updated into the users vector. It will search for the `Person` in the vector with matching ID and replace it. | +| `string chgUsername();` | Changes the `username` of the `Person`. | +| `string chgPassword(Person);` | Changes the `password` of the `Person`. | +| `string chgEmail();` | Changes the `email` of the `Person`. | +| `string chgPhoneNo();` | Changes the `phoneNo` of the `Person`. + +## Vehicle.hpp / Vehicle.cpp + +#### Constructors + +| Parameters | Task | +|:-----------|:-----------------------------| +| `(int length, int width, int id)` | Basic constructor that fill in the rest of the missing information with "TBA". | +| `(string type, int length, int width, string origin, string destination, string dateNtime, int id)` | Complete constructor with all the information except the seatMap. | +| `(string type, int length, int width, string origin, string destination, string dateNtime, int id, vector< vector > seatMap)` | Complete constructor that is used to read data from the database. | + +#### Functions + +| Function | Task | +|:---------------------------|:-------------------------| +| `void setType(string type);` | Set `type` to the new given input. | +| `void setOrigin(string origin);` | Set `origin` to the new given input. | +| `void setDestination(string destination);` | Set `destination` to the new given input. | +| `void setDateNTime(string dateNtime);` | Set `dateNtime` to the new given input. | +| `string getType();` | Return `type` to the caller. | +| `int getLength();` | Return `length` to the caller. | +| `int getWidth();` | Return `width` to the caller. | +| `string getOrigin();` | Return `origin` to the caller. | +| `string getDestination();` | Return `destination` to the caller. | +| `string getDateNTime();` | Return `dateNtime` to the caller. | +| `int getId();` | Return `id` to the caller. | +| `void initialize();` | Initialize the `seatMap` to the intended size. | +| `bool bookSeat(int x, int y, int guestId);` | Register a specific seat to the given guestId. Returns if the proces is successful. | +| `bool checkAvailabilty(int x, int y);` | Check if the seat at the given coordinate is still available. | +| `void printMap();` | Print the map with label of 'A' as *available* and 'X' as *not available*. | +| `void printMap(int guestId);` | Takes in the user id and print the map with label of 'A' as *available*, 'U' as the *user* and 'X' as *not available*. | + +## VehicleManager.hpp / VehicleManager.cpp + +#### Constructors + +| Parameters | Task | +|:-----------|:--------------------------------| +| `()` | Empty constructor. Creates an empty vector of `vehicles`. | +| `(string jsonFile)` | Creates a vector of `vehicles` by importing the data from a json file. | + +#### Functions + +| Function | Task | +|:----------------------------------|:-------------------------| +| `bool add(Vehicle newVehicle);` | Add a new `Vehicle` into the vector. | +| `bool remove(Vehicle toRemove);` | Remove a specific `Vehicle` from the vector. | +| `Vehicle get(int id);` | Get a specific `Vehicle` with the given `id`. | +| `void toJson(string jsonFile);` | Export all data to a json file. | +| `int getId();` | Returns a suggested `id` for the next item. |