Question
Create new C++ source files named pokemon.cpp1 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.cpp1 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.
The following files are given to you: 1. A C++ header file (pokemon.h) declaring the Pokemon class. 2. A C++ header file (pokedex.h) declaring the Pokedex class. 3. A C++ source file (main.cpp) containing a main() function with tests. 4. A text file (pokedex.txt) containing a list of all normal, fighting, flying, and poison Pokemon, one per line, in the summary string format described in pokemon.h
Please please help. I\'m so very lost.
Also it says the question is too long so Im seperating the files into two questions which will be linked. Please help and look at the two questions to obtain the full answer. this is the link to the of pokedex.txt and pokemon.h
#include #include #include #include #include #include \"pokedex.h\"
using namespace std;
inline void _test(const char* expression, const char* file, int line) { cerr < \"test(\"=\"\">< expression=\"\">< \")=\"\" failed=\"\" in=\"\" file=\"\" \"=\"\">< file=\"\">< \",=\"\" line=\"\" \"=\"\">< line=\"\">< \".\"=\"\"><> //abort(); }
#define test(EXPRESSION) ((EXPRESSION) ? (void)0 : _test(#EXPRESSION, __FILE__, __LINE__))
int main() { // ***** Test Pokemon *****
// Test type_to_string() test(type_to_string(Pokemon::Normal) == \"Normal\"); test(type_to_string(Pokemon::Fighting) == \"Fighting\"); test(type_to_string(Pokemon::Flying) == \"Flying\"); test(type_to_string(Pokemon::Poison) == \"Poison\");
// Test string_to_type() test(string_to_type(\"Normal\") == Pokemon::Normal); test(string_to_type(\"Fighting\") == Pokemon::Fighting); test(string_to_type(\"Flying\") == Pokemon::Flying); test(string_to_type(\"Poison\") == Pokemon::Poison); string_to_type(\"Sleepy\");
// Test string-based constructor via // checking that instance variables were set correctly. Pokemon bouffalant(\"Bouffalant, #626, Normal,\"); Pokemon mankey(\"Mankey, #056, Fighting,\"); Pokemon tornadus(\"Tornadus, #641, Flying,\"); Pokemon grimer(\"Grimer, #088, Poison,\"); Pokemon timburr(\"Timburr, #532, Fighting,\"); Pokemon tonkamon(\"Tonkamon, #001, Flying,\"); Pokemon pidgey(\"Pidgey, #016, Normal, Flying,\"); Pokemon fletchling(\"Fletchling, #661, Normal, Flying,\"); Pokemon zubat(\"Zubat, #041, Poison, Flying,\"); Pokemon toxicroak(\"Toxicroak, #454, Poison, Fighting,\"); Pokemon golbat(\"Golbat, #042, Poison, Flying,\"); Pokemon hoothoot(\"Hoothoot, #163, Flying, Normal,\");
// Check that _name was set correctly test(bouffalant.name() == \"Bouffalant\"); test(mankey.name() == \"Mankey\"); test(tornadus.name() == \"Tornadus\"); test(grimer.name() == \"Grimer\"); test(timburr.name() == \"Timburr\"); test(tonkamon.name() == \"Tonkamon\");
test(pidgey.name() == \"Pidgey\"); test(fletchling.name() == \"Fletchling\"); test(zubat.name() == \"Zubat\"); test(toxicroak.name() == \"Toxicroak\"); test(golbat.name() == \"Golbat\"); test(hoothoot.name() == \"Hoothoot\");
// Check that _ndex was set correctly test(bouffalant.Ndex() == 626); test(mankey.Ndex() == 56); test(tornadus.Ndex() == 641); test(grimer.Ndex() == 88); test(timburr.Ndex() == 532); test(tonkamon.Ndex() == 1);
test(pidgey.Ndex() == 16); test(fletchling.Ndex() == 661); test(zubat.Ndex() == 41); test(toxicroak.Ndex() == 454); test(golbat.Ndex() == 42); test(hoothoot.Ndex() == 163);
// Check that types were set correctly test(bouffalant.type1() == Pokemon::Normal); test(!bouffalant.is_multitype());
test(mankey.type1() == Pokemon::Fighting); test(!mankey.is_multitype());
test(tornadus.type1() == Pokemon::Flying); test(!tornadus.is_multitype());
test(grimer.type1() == Pokemon::Poison); test(!grimer.is_multitype());
test(timburr.type1() == Pokemon::Fighting); test(!timburr.is_multitype());
test(tonkamon.type1() == Pokemon::Flying); test(!tonkamon.is_multitype());
test(pidgey.type1() == Pokemon::Normal); test(pidgey.is_multitype()); test(pidgey.type2() == Pokemon::Flying); test(fletchling.type1() == Pokemon::Normal); test(fletchling.is_multitype()); test(fletchling.type2() == Pokemon::Flying); test(zubat.type1() == Pokemon::Poison); test(zubat.is_multitype()); test(zubat.type2() == Pokemon::Flying); test(toxicroak.type1() == Pokemon::Poison); test(toxicroak.is_multitype()); test(toxicroak.type2() == Pokemon::Fighting); test(golbat.type1() == Pokemon::Poison); test(golbat.is_multitype()); test(golbat.type2() == Pokemon::Flying);
test(hoothoot.type1() == Pokemon::Flying); test(hoothoot.is_multitype()); test(hoothoot.type2() == Pokemon::Normal);
// Test summary() test(bouffalant.summary() == \"Bouffalant, #626, Normal,\"); test(mankey.summary() == \"Mankey, #056, Fighting,\"); test(tornadus.summary() == \"Tornadus, #641, Flying,\"); test(grimer.summary() == \"Grimer, #088, Poison,\"); test(timburr.summary() == \"Timburr, #532, Fighting,\"); test(tonkamon.summary() == \"Tonkamon, #001, Flying,\");
test(pidgey.summary() == \"Pidgey, #016, Normal, Flying,\"); test(fletchling.summary() == \"Fletchling, #661, Normal, Flying,\"); test(zubat.summary() == \"Zubat, #041, Poison, Flying,\"); test(toxicroak.summary() == \"Toxicroak, #454, Poison, Fighting,\"); test(golbat.summary() == \"Golbat, #042, Poison, Flying,\"); test(hoothoot.summary() == \"Hoothoot, #163, Flying, Normal,\");
// ***** Test Pokedex *****
Pokedex D1;
// Test add() and size() test(D1.size() == 0); D1.add(&bouffalant); test(D1.size() == 1); D1.add(&mankey); test(D1.size() == 2); D1.add(&tornadus); test(D1.size() == 3); D1.add(&grimer); test(D1.size() == 4); D1.add(&timburr); test(D1.size() == 5); D1.add(&tonkamon); test(D1.size() == 6); D1.add(&pidgey); test(D1.size() == 7); D1.add(&fletchling); test(D1.size() == 8); D1.add(&zubat); test(D1.size() == 9); D1.add(&toxicroak); test(D1.size() == 10); D1.add(&golbat); test(D1.size() == 11); D1.add(&hoothoot); test(D1.size() == 12);
D1.add(&bouffalant); test(D1.size() == 12); D1.add(&hoothoot); test(D1.size() == 12);
//THIS IS THE SECOND PART OF MAIN.CPP. Im sorry but it literally wouldnt fit in one question. please look at all linked parts to solve question. please please help
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