Question
Create new C++ source files named pokemon.cpp and pokedex.cpp that implement the classes declared in pokemon.h and pokedex.h, respectively, so that pokemon.cpp, pokedex.cpp, and the
Create new C++ source files named pokemon.cpp and pokedex.cpp that implement the classes declared in pokemon.h and pokedex.h, respectively, so that pokemon.cpp, pokedex.cpp, and the provided files compile into a program that runs with no failed tests.
//pokemon.txt
Aipom, #190, Normal, Ambipom, #424, Normal, Arbok, #024, Poison, Arceus, #493, Normal, Audino, #531, Normal, Bidoof, #399, Normal, Blissey, #242, Normal, Bouffalant, #626, Normal, Braviary, #628, Normal, Flying, Buneary, #427, Normal, Bunnelby, #659, Normal, Castform, #351, Normal, Chansey, #113, Normal, Chatot, #441, Normal, Flying, Cinccino, #573, Normal, Conkeldurr, #534, Fighting, Croagunk, #453, Poison, Fighting, Crobat, #169, Poison, Flying, Delcatty, #301, Normal, Ditto, #132, Normal, Dodrio, #085, Normal, Flying, Doduo, #084, Normal, Flying, Dunsparce, #206, Normal, Eevee, #133, Normal, Ekans, #023, Poison, Exploud, #295, Normal, Farfetch\'d, #083, Normal, Flying, Fearow, #022, Normal, Flying, Fletchling, #661, Normal, Flying, Furfrou, #676, Normal, Furret, #162, Normal, Garbodor, #569, Poison, Glameow, #431, Normal, Golbat, #042, Poison, Flying, Grimer, #088, Poison, Gulpin, #316, Poison, Gurdurr, #533, Fighting, Happiny, #440, Normal, Hariyama, #297, Fighting, Hawlucha, #701, Fighting, Flying, Herdier, #507, Normal, Hitmonchan, #107, Fighting, Hitmonlee, #106, Fighting, Hitmontop, #237, Fighting, Hoothoot, #163, Flying, Normal, Kangaskhan, #115, Normal, Kecleon, #352, Normal, Koffing, #109, Poison, Lickilicky, #463, Normal, Lickitung, #108, Normal, Lillipup, #506, Normal, Linoone, #264, Normal, Lopunny, #428, Normal, Loudred, #294, Normal, Machamp, #068, Fighting, Machoke, #067, Fighting, Machop, #066, Fighting, Makuhita, #296, Fighting, Mankey, #056, Fighting, Meowth, #052, Normal, Mienfoo, #619, Fighting, Mienshao, #620, Fighting, Miltank, #241, Normal, Minccino, #572, Normal, Muk, #089, Poison, Munchlax, #446, Normal, Nidoran?, #029, Poison, Nidoran?, #032, Poison, Nidorina, #030, Poison, Nidorino, #033, Poison, Noctowl, #164, Normal, Flying, Pancham, #674, Fighting, Patrat, #504, Normal, Persian, #053, Normal, Pidgeot, #018, Normal, Flying, Pidgeotto, #017, Normal, Flying, Pidgey, #016, Normal, Flying, Pidove, #519, Normal, Flying, Porygon, #137, Normal, Porygon-Z, #474, Normal, Porygon2, #233, Normal, Primeape, #057, Fighting, Purugly, #432, Normal, Raticate, #020, Normal, Rattata, #019, Normal, Regigigas, #486, Normal, Riolu, #447, Fighting, Rufflet, #627, Normal, Flying, Sawk, #539, Fighting, Sentret, #161, Normal, Seviper, #336, Poison, Skitty, #300, Normal, Slaking, #289, Normal, Slakoth, #287, Normal, Smeargle, #235, Normal, Snorlax, #143, Normal, Spearow, #021, Normal, Flying, Spinda, #327, Normal, Stantler, #234, Normal, Staraptor, #398, Normal, Flying, Staravia, #397, Normal, Flying, Starly, #396, Normal, Flying, Stoutland, #508, Normal, Swablu, #333, Normal, Flying, Swalot, #317, Poison, Swellow, #277, Normal, Flying, Taillow, #276, Normal, Flying, Tauros, #128, Normal, Teddiursa, #216, Normal, Throh, #538, Fighting, Timburr, #532, Fighting, Tornadus, #641, Flying, Toxicroak, #454, Poison, Fighting, Tranquill, #520, Normal, Flying, Trubbish, #568, Poison, Tyrogue, #236, Fighting, Unfezant, #521, Normal, Flying, Ursaring, #217, Normal, Vigoroth, #288, Normal, Watchog, #505, Normal, Weezing, #110, Poison, Whismur, #293, Normal, Zangoose, #335, Normal, Zigzagoon, #263, Normal, Zubat, #041, Poison, Flying,
//pokemon.h
#ifndef POKEMON_H #define POKEMON_H
#include
using namespace std;
class Pokemon { public:
// Same as homework 1
enum Type {Normal, Fighting, Flying, Poison};
Pokemon(string name, int ndex, Type type1); Pokemon(string name, int ndex, Type type1, Type type2); string name(); int Ndex(); Type type1(); bool is_multitype(); Type type2(); float damage_multiplier(Type attack_type);
// New for this homework
// A summary string is a single string that contains // all of a Pokemon\'s information. // // A Pokemon with one type and Ndex 5 has // a summary string of the form: // \"Name, #005, type1,\" // // Similarly, a Pokemon with two types and Ndex 12 has // a summary string of the form: // \"Name, #012, type1, type2,\"
// Initializes a Pokemon from a summary string // // Hint: check out the stoi function in Pokemon(string summary);
// Returns the summary string of the Pokemon string summary();
private: int _ndex; // Stores the Pokemon\'s Ndex string _name; // Stores the Pokemon\'s name Type types[2]; // Stores the Pokemon\'s types (1 or 2 of them) int type_count; // Stores how many types the Pokemon has };
// Returns a string corresponding to the type. Examples: // 1. type_to_string(Pokemon::Poison) returns \"Poison\". // 2. type_to_string(Pokemon::Normal) returns \"Normal\". string type_to_string(Pokemon::Type t);
// Returns the type corresponding to a string. Examples: // 1. string_to_type(\"Poison\") returns Pokemon::Poison. // 2. string_to_type(\"Flying\") returns Pokemon::Flying. // 3. If the given string doesn\'t correspond to a Pokemon type // return Pokemon::Normal Pokemon::Type string_to_type(string s);
#endif
//ALL LINKED QUESTIONS. PLEASE LOOK AT ALL PARTS TO GET ONE ANSWER. PLEASE
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started