Question: Need help initializing in Garden Class: //--- Definition of constants: ---// // PURPOSE: To tell how many flowers each bee hive must visit. const int

Need help initializing in Garden Class: //--- Definition of constants: ---// // PURPOSE: To tell how many flowers each bee hive must visit. const int NUM_FLOWERS_TO_COLLECT = 5; // PURPOSE: To tell the number of bee hives that exist. const int NUM_BEE_HIVES = 4; // PURPOSE: To hold the names of the flowers: const char* FLOWER_NAME_ARRAY[] = { "Jasmine", "Daffodil", "Daisy", "Dandelion", "Venus fly trap", "Tumbleweed", "Kudzu", "Poison Ivy" }; // PURPOSE: To tell how many flower names there are. const size_t NUM_FLOWER_NAMES= sizeof(FLOWER_NAME_ARRAY)/sizeof(const char*); //--- Definition of classes and structs: ---// // PURPOSE: To represent a flower. class Flower { // I. Member vars: // PURPOSE: To hold address of the name of the flower as a C-string. const char* nameCPtr_; // PURPOSE: To hold the address of the Flower instance after '*this' one, // or 'NULL' if there is no such Flower. Flower* nextPtr_; // II. Disallowed auto-generated methods: // No copy constructor: Flower (const Flower&); // No copy assignment op: Flower& operator= (const Flower&); protected : // III. Protected methods: public : // IV. Constructor(s), assignment op(s), factory(s) and destructor: // PURPOSE: To make '*this' a stand-alone Flower instance with a randomly- // chosen name. No parameters. No return value. Flower () : nameCPtr_(FLOWER_NAME_ARRAY[rand() % NUM_FLOWER_NAMES] ), nextPtr_(NULL) { } // PURPOSE: To release the resources of '*this'. No parameters. No // return value. ~Flower () { } // V. Accessors: // PURPOSE: To return the name of the flower. No parameters. const char* getNameCPtr () const { return(nameCPtr_); } // PURPOSE: To return the address of the Flower instance after '*this' one, // or 'NULL' if there is no such Flower. Flower* getNextPtr () const { return(nextPtr_); } // VI. Mutators: // PURPOSE: To note that the next flower in the list has address // 'newNextPtr'. No return value. void setNextPtr (Flower* newNextPtr ) { nextPtr_ = newNextPtr; } // VII. Methods that do main and misc work of class: }; 
class Garden { // I. Member vars: // Three Member Vars: 1. Pointer to Beginning of List (startPtr_=NULL;?) 2. Pointer to End of List (endPtr_=NULL;?) 3. Int holding length of list (LEN_GARDEN_LIST) // II. Disallowed auto-created methods: // No copy constructor: Garden (const Garden&); // No copy assignment op: Garden& operator= (const Garden&); protected : // III. Protected methods: public : // IV. Constructor(s), assignment op(s), factory(s) and destructor: // PURPOSE: To initialize '*this' to an empty garden. No parameters. // No return value. Garden () { // INITIALIZE HERE } // PURPOSE: To release the resources of '*this'. No parameters. // No return value. ~Garden () { // GET RID OF LIST HERE } // V. Accessor(s): // PURPOSE: To hold length of '*this' list. int getNumFlowers () const { return(LEN_GARDEN_LIST); // VI. Mutator(s): // VII. Methods that do main and misc. work of class: // PURPOSE: To add the Flower with address 'flowerPtr' at the back of // '*this' Garden of Flower instances. No return value. void store (Flower* flowerPtr ) { // THIS IS WHERE LIST IS ADDED ONTO  } 

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!