Simplified Pokedex Development

Job ID: 38223030

Budget: $2 – $8 USD

You will create a simplified pokedex from the popular game/show Pokemon. If you don't know anything about pokemon, that shouldn't affect your understanding of the assignment since this assignment is based on reading from a file containing relevant data.

Write a program that loads all discovered pokemon data from a csv file (see pokemon.csv or pokemon_small.csv for format- one just has fewer stored pokemon for easier debugging as you code) and loads all registered pokemon trainer data (see trainer.csv for format). The names of the csv files should be provided as command line arguments, like so: ./pokedex trainer.csv pokemon.csv, do NOT hardcode them in as we will be changing the file names for our tests. Additionally, you must perform a check to ensure enough entries were made on the commandline (3), and that both files to be read from exist. If they do not, display an error message, and then gracefully terminate the program by returning an int that is not 0 to signal that there was an error running the program. CSV stands for comma separated values, and it is a simplified version of an excel spreadsheet. It can be opened in any spreadsheet editor, or you can open it in vscode to see the exact formatting you will have when you treat each row as a string. To parse the csv files, you will not use any library. Instead, every entry in a column in the file is separated by a comma which can be used to separate each field into it's own variable (parse) when you read the data in. Each row in a file denotes a single object that should be created, so a row in pokemon.csv is equivalent to a single Pokemon object, which should be stored in an array of pokemon (not an array of strings), and a row in trainer.csv is equivalent to a single Trainer object, which should be stored in an array of Trainers. The program should clean up misformatted data, such as extra periods on descriptions or extra quotation marks left behind on a description so that it displays nicely, and update each trainer's pokemon so that it contains all of the relevant data that was stored about that pokemon in the pokemon file.

After reading all data and storing it in arrays of the appropriate class type, and making the above mentioned adjustments, the program should identify all 18 pokemon types by sorting through all of the pokemon in the pokemon database and constructing an array of unique types. This will be used in the display by type functionalities later. Then, the main menu should be displayed and prompt the user to view by trainer, view by pokemon, or exit the pokedex. If the user chooses to exit, the program should terminate gracefully by returning 0.

If the user chooses to view by trainer, the trainer menu should be displayed and prompt users to view trainers by preferred pokemon type, view trainers by name alphabetically, return to the main menu, or close the pokedex. If the user chooses to close the pokedex, the function should return the selected option to main so that it knows to return 0 and gracefully terminate. If the user chooses to return to the main menu, the function should return the selected option to main so that main knows to loop again and display the main menu. If the user chooses to view trainers by preferred pokemon type, the types array constructed in the previous step should be sorted alphabetically and then used to display all of the types of pokemon as menu options. The user should be able to select a type numerically, and then the names of all trainers who prefer the selected type of pokemon should be displayed as menu options using the trainers array. If there aren't any trainers who prefer that type, a message should tell the user that. If there are trainers who prefer that type, the names of the trainer should be displayed and the user should be able to numerically select the trainer they'd like to view. Once a trainer is selected, all of their stats, including pokemon and their stats, should be displayed to the screen. If the user chooses to view alphabetically by trainer name, the trainers in the trainers array should be sorted by their names, and then displayed as menu options. The user should be able to numerically select a trainer's name, and then all of the data for that trainer, including pokemon and their stats, should be displayed to the screen.

If the user chooses to view by pokemon, the pokemon menu should be displayed and prompt users to view pokemon by type, view pokemon by name alphabetically, return to main menu, or close the pokedex. If the user chooses to close the pokedex, the function should return the selected option to main so that it knows to return 0 and gracefully terminate. If the user chooses to return to the main menu, the function should return the selected option to main so that main knows to loop again and display the main menu. If the user chooses to view pokemon by type, the types array constructed in the previous step should be sorted alphabetically and then used to display all of the types of pokemon as menu options. The user should be able to select a type numerically, and then the names of all pokemon of that type should be displayed as menu options using the pokemon array. The user should be able to numerically select a pokemon that has been displayed, and then the information for that pokemon should be displayed to the screen. If the user chooses to view alphabetially by pokemon name, the pokemon in the pokemon array should be sorted by their names. Then, the program should split the pokemon into five close-to-equal in size subsets of pokemon (the last subset can be larger to include possible remainder options) and display the name ranges for the five subsets for the user to select from. The user should be able to select a range numerically, and then all pokemon names in that range should be displayed. The user should be able to select a name numerically and view the information for the selected pokemon.

Be sure to run the provided pokedex example executable several times in several different ways to make sure you understand these directions and how they correlate to the operation of the program before you start programming!

The example executable:
An example executable is provided in this repository. You should be able to run it from your project folder. If you encounter a “permission denied” error when attempting to run the executable, type chmod u+x pokedexExample into the terminal and try running the executable again by doing ./pokedexExample trainer.csv pokemon.csv. I suggest running the program a few times with various changes to see how it behaves.

Supplied Code:
For this assignment, you have basically been given the code necessary to run the pokemon data viewing portion of the program. Your job will be to add the code that runs the trainer data viewing portion of the program. You will find helpers.h, helpers.cpp, main.cpp, pokemon.h, pokemon.cpp, and the makefile have already been created and included in your repo. Do not alter pokemon.h, pokemon.cpp, or any of the supplied functions in helpers. You may alter the makefile and main as you see fit, and you can add additional helper functions to helpers; you will also need to add files to create the trainer class (details below). All supplied functions must be used in your program, and there are some functions, such as bubbleSortString, that should be reused rather than creating a new function. Part of your grade will be determined by how well you make use of the existing code. Each of the supplied files has extensive documentation, including class headers and function headers, so read it carefully. Please also note that I've given a significant amount of code to you on your first assignment so that you can see how the C++ style guidelines should be used when writing your code. For example, you'll notice that none of the supplied functions were longer than 75 lines and that all function names are descriptive. My hope is that this will make the syle guidelines clearer, as well as show you how I break up code by functionality into functions since many students struggle with this aspect of design. It should also help show you how a csv is parsed in parsePokemon, though obviously the pattern you follow to parse the trainer file will be different.

Your Code:
You will be required to write the Trainer class, modify main.cpp to run the trainer half of the program, and to add any helper functions to run the trainer half of the program. The trainer class and things like that are provided, but you may need to fix them. You will also need to edit the makefile to create a trainer.o file that is included in the final pokedex executable. The function headers for all required helper functions are stored in helpers.cpp, though the function declarations are not in the h file, and the implementation is not in the cpp file. The function headers should be used to declare and implement the described function. Note that in some cases, the function header describes a function that does not perfectly follow our C++ guidelines- in this case, the description will explicitly state that the function should be broken up into other functions that are called from that function if you want full style credit. You will notice that I have not included a header comment in main.cpp- you will need to supply your own following style guide instructions.

NOTE: You will only use simple C++ programming and ONLY use simple code. DO NOT USE CHATGPT / PLAGARIZED CODE.
Related categories: C Programming C++ Programming