Question: C++ program, can you help me finish this code _use binary search for pet _get random numLimbs between 0, 2, 4, 8 // A Pet

C++ program, can you help me finish this code

_use binary search for pet

_get random numLimbs between 0, 2, 4, 8

// A Pet Class and its driver #include #include

// Pet class with a name, id, numLimbs. // Also has a static population member. class Pet { private: string name; long id; int numLimbs; // static int population = 0; public: // Ctrs Pet(); Pet(string name, long id, int numLimbs);

// Getters or Accessors long getID() const; string getName() const; int getNumLimbs() const; // Setters or Mutators bool setID(long id); bool setName(string name); bool setNumLimbs(int numLimbs) { this->numLimbs = numLimbs; } // Serialization string to_string() const; // E.g. Returns "Pet: ufomo. ID: 1024; number of Limbs: 8" };

// Global function to generate a cool sounding name by picking // consonants and vowels in alternate fashion. string makeCoolName(int len) { // Your code from before goes here. return "A. Cool. Name"; }

// In this main driver, we initialize an array of STORE_SIZE Pets // Assign them random values, and enter a user interaction loop // in which the user types in a desired ID, and the system will // search the store for a pet with the ID and print its details. int main() { const int STORE_SIZE = 10*1000; // Declare an array of pets Pet pets[STORE_SIZE]; // Loop over the pets to initialize each Pet // Enter a user interaction loop in which we // - prompt the user for an ID // - Scan the array of pets (my pet store) for a Pet with that ID // - If found, print the details of the pet // - If not found, say "No such pet exists in this store" or equiv. message // - If the user entered 0 or a negative number in his/her ID search, exit gracefully.

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!