How many pets do you have? 3 What is the name of your pet? Buttercup What type of pet is Buttercup? dog Creating a new pet CSIS 112 In main(), prompt the user to enter the number of pets in his or her household. Dynamically create a built-in array based on this number (not a vector or object of the array class) to hold pointers to Pet objects. What is the name of your pet? Charlie what type of pet is Charlie? cat Creating a new pet What is the name of your pet? Porky What type of pet is Porky? pig Creating a new pet Construct a loop in main() that executes once for each of the number of pets that the user indicated. Within this loop, ask the user to enter the name and type of pet. Using a random number generator, generate a weight between 1-100 pounds. Seed this random number generator with 100. Next, dynamically create a Pet object (remember that this requires the use of the "new" keyword which returns a pointer to the location in memory where this pet object was created.) Create each object using the default constructor of the class, and call the set functions to store the name, type, and weight of each pet. Store each Pet pointer in the array. These are the pets you have: Pet name: Buttercup Pet type: Pet weight: dog 66 Pet name: Charlie Pet type: Pet weight: cat 17 Pet name: Porky pig 16 Pet type: Pet weight: In the pet destructor In the pet destructor In the pet destructor Press any key to continue After all of the pet objects have been constructed and added to the array, print out the contents of the array. Because the program uses dynamic memory to store the array as well as the objects in the array, be sure to de-allocate all of the memory before exiting. A sample of the program running is shown below:

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 3RP
icon
Related questions
Question

Can i get help writing this. It has to use a random number generator plus other requirements. All you need is in the photos

AutoSave
CSIS112_C_Plus_Plus_Programming_Assignments_Instructions(1)-1 - Compatibility Mode - Saved -
O Search
Brightwell, Steven E BS
File
Home
Insert
Draw
Design
Layout
References
Mailings
Review
View
Help
RCM
PERRLA
A Share
P Comments
How many pets do you have?
What is the name of your pet?
Buttercup
What type of pet is Buttercup?
dog
Creating a new pet
CSIS 112
In main(), prompt the user to enter the number of
pets in his or her household. Dynamically create
a built-in array based on this number (not a
由
What is the name of your pet?
Charlie
What type of pet is Charlie?
vector or object of the array class) to hold
pointers to Pet objects.
cat
Creating a new pet
What is the name of your pet?
Porky
What type of pet is Porky?
pig
Creating a new pet
Construct a loop in main() that executes once for
each of the number of pets that the user indicated.
Within this loop, ask the user to enter the name
and type of pet. Using a random number
generator, generate a weight between 1-100
pounds. Seed this random number generator with
100. Next, dynamically create a Pet object
(remember that this requires the use of the "new"
keyword which returns a pointer to the location
in memory where this pet object was created.)
Create each object using the default constructor
of the class, and call the set functions to store the
These are the pets you have:
Buttercup
dog
Pet name:
Pet type:
Pet weight:
66
Pet name:
Charlie
Pet type:
Pet weight:
cat
17
name, type, and weight of each pet. Store each
Pet pointer in the array.
Pet name:
Porky
pig
Pet type:
Pet weight:
16
After all of the pet objects have been constructed
and added to the array, print out the contents of
In the pet destructor
In the pet destructor
In the pet destructor
Press any key to continue .
the array.
Because the program uses dynamic memory to
store the array as well as the objects in the array, be sure to de-allocate all of the memory before
exiting.
A sample of the program running is shown below:
ENG
6:51 AM
9/29/2021
Page 24 of 38
9617 words
E English (United States)
W Accessibility: Unavailable
O Focus
目
100%
Transcribed Image Text:AutoSave CSIS112_C_Plus_Plus_Programming_Assignments_Instructions(1)-1 - Compatibility Mode - Saved - O Search Brightwell, Steven E BS File Home Insert Draw Design Layout References Mailings Review View Help RCM PERRLA A Share P Comments How many pets do you have? What is the name of your pet? Buttercup What type of pet is Buttercup? dog Creating a new pet CSIS 112 In main(), prompt the user to enter the number of pets in his or her household. Dynamically create a built-in array based on this number (not a 由 What is the name of your pet? Charlie What type of pet is Charlie? vector or object of the array class) to hold pointers to Pet objects. cat Creating a new pet What is the name of your pet? Porky What type of pet is Porky? pig Creating a new pet Construct a loop in main() that executes once for each of the number of pets that the user indicated. Within this loop, ask the user to enter the name and type of pet. Using a random number generator, generate a weight between 1-100 pounds. Seed this random number generator with 100. Next, dynamically create a Pet object (remember that this requires the use of the "new" keyword which returns a pointer to the location in memory where this pet object was created.) Create each object using the default constructor of the class, and call the set functions to store the These are the pets you have: Buttercup dog Pet name: Pet type: Pet weight: 66 Pet name: Charlie Pet type: Pet weight: cat 17 name, type, and weight of each pet. Store each Pet pointer in the array. Pet name: Porky pig Pet type: Pet weight: 16 After all of the pet objects have been constructed and added to the array, print out the contents of In the pet destructor In the pet destructor In the pet destructor Press any key to continue . the array. Because the program uses dynamic memory to store the array as well as the objects in the array, be sure to de-allocate all of the memory before exiting. A sample of the program running is shown below: ENG 6:51 AM 9/29/2021 Page 24 of 38 9617 words E English (United States) W Accessibility: Unavailable O Focus 目 100%
CSIS112_C_Plus_Plus_Programming_Assignments_Instructions(1)-1 - Compatibility Mode - Saving. -
P Search
AutoSave
Brightwell, Steven E BS
File
Design
References
Mailings
Review
View
Help
Table Design
A Share
P Comments
Home
Insert
Draw
Layout
RCM
PERRLA
Layout
由
田
Executes without crashing
Appropriate Internal Documentation
Pet Class
Data members: name, type, weight
Constructor/destructor
Getters/setters as appropriate
Main: The following items must be implemented in main() or by functions called from
main() They must not be implemented in the Pet class
Prompts user for the number of pets
Creates the pet array using dynamic memory allocation
Dynamically creates a pet object
Generates a random weight (between 1-100 inclusive) for each pet
Seed is 100
Prints contents of array as illustrated in diagram
De-allocates memory (both the array and the contents of the array) before exiting
Style:
Modular design, no global variables, etc.
ENG
6:53 AM
9/29/2021
Page 26 of 37
Page 26 of 37
9617 words
E English (United States)
W Accessibility: Unavailable
O Focus
目
100%
Transcribed Image Text:CSIS112_C_Plus_Plus_Programming_Assignments_Instructions(1)-1 - Compatibility Mode - Saving. - P Search AutoSave Brightwell, Steven E BS File Design References Mailings Review View Help Table Design A Share P Comments Home Insert Draw Layout RCM PERRLA Layout 由 田 Executes without crashing Appropriate Internal Documentation Pet Class Data members: name, type, weight Constructor/destructor Getters/setters as appropriate Main: The following items must be implemented in main() or by functions called from main() They must not be implemented in the Pet class Prompts user for the number of pets Creates the pet array using dynamic memory allocation Dynamically creates a pet object Generates a random weight (between 1-100 inclusive) for each pet Seed is 100 Prints contents of array as illustrated in diagram De-allocates memory (both the array and the contents of the array) before exiting Style: Modular design, no global variables, etc. ENG 6:53 AM 9/29/2021 Page 26 of 37 Page 26 of 37 9617 words E English (United States) W Accessibility: Unavailable O Focus 目 100%
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning