Question
ZOO Program in C , that follows: A Class Zoo following data members Animal Name a String of maximum 50 characters if upon construction of
ZOO
Program in C, that follows:
A Class Zoo following data members
Animal Name
- a String of maximum 50 characters
- if upon construction of the Animal object or modification of the name data member, the name is being set to a
String longer than 50 character you need to truncate the string at 46 characters and append the character sequence ... to the end (that is a leading space before the ...)
Date
- A string of the format yyyy-mm-dd
The class should have the following methods
- a constructor which takes values for all 4 attributes and sets them need to ensure that the name string length is not exceeded otherwise do as require
- Need to ensure that incoming value for creationDate is in the required format If not, leave blank.
Visits
- an integer representing the number of visits that the animal has been
Which ZOO
a single character value indicating which of the zoo, values are:
'MG 'for Minas
'RJ' for Rio
Following Methods:
- a constructor which takes values for all 4 attributes and sets them
- need to ensure that the name string length is not exceeded otherwise do as required
- need to ensure that incoming value for Which ZOO data member is valid. If not, mark the animal as Not Placed
- need to ensure that incoming value for Visits is greater than or equal to zero If not, set to zero.
- need to ensure that incoming value Date is in the required format If not, leave blank
- a constructor which takes only the name and Date attributes and defaults the Visits attribute to a value of 0, and the Which ZOO attribute to N
- need to ensure that the name string length is not exceeded, otherwise do as required
- need to ensure that incoming value for Date is in the required format. If not, leave blank no other input validation is necessary in this constructor
- a destructor which prints " Eliminated
- accessors for Each of the attributes
- a mutator for each of the Visits and Which ZOO attributes
- perform validation on the incoming parameter value and only set the data-members value if the incoming value is valid
- if the value is not valid then the current value for the data member is left alone
- your mutator should also return a bool data type to indicate whether the incoming value was valid or not
Info(void)
this method is called in order to print out the current value of all of the data members for the object
PlaceAnimal(char whichZoo)
this method is called in order to place or position the character at a particular park
SameMovies(ZOO& anotherAnimal)
this method is called upon to set the number of movies that this Animal has been in to the same number of visits as the specified animal (from parameter)
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