Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DisneyCharacter.h the file that contains the class definition for this exercise o DisneyCharacter.c the source file that contains the method bodies (the code) for the

DisneyCharacter.h the file that contains the class definition for this exercise o DisneyCharacter.c the source file that contains the method bodies (the code) for the class o testDisneyCharacter.c your testharness (main function) which you will use to test your class

The Requirements for this c Program This should be a simple one I want you to write a class definition for a class to be known as DisneyCharacter. Here are the particulars of the class: The Class Particulars The class has the following data members name a string1 of maximum 50 characters if upon construction of the DisneyCharacter 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 creationDate a string of the format yyyy-mm-dd (example value 2012-01-30) numMovies an integer representing the number of movies that the character has been in whichPark a single character value indicating which of the DisneyWorld / DisneyLand parks the character can be found in allowable values are: M for Magic Kingdom S for Disney Studios A for Animal Kingdom E for Epcot C for California Adventure N to indicate the character is not placed The class should have the following methods o a constructor which takes values for all 4 attributes and sets them 1 You can choose to use a char[] for this data member or a string object either way, you still need to be able to limit the maximum length to 50 characters

need to ensure that the name string length is not exceeded otherwise do as required need to ensure that incoming value for whichPark data member is valid. If not, mark the character as Not Placed. need to ensure that incoming value for numMovies is greater than or equal to zero. If not, set to zero. need to ensure that incoming value for creationDate is in the required format. If not, leave blank o a constructor which takes only the name and creationDate attributes and defaults the numMovies attribute to a value of 0, and the whichPark 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 creationDate is in the required format. If not, leave blank no other input validation is necessary in this constructor o a destructor which prints out message to say destroyed. When invoked e.g if the DisneyCharacter is Tigger then it states Tigger destroyed o accessors for each of the attributes o a mutator for each of the numMovies and whichPark attributes your mutators like good mutators should 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 o also declare the following public methods ShowInfo(void) this method is called in order to print out the current value of all of the data members for the object PlaceCharacter(char whichPark) this method is called in order to place or position the character at a particular park SameMovies(DisneyCharacter& anotherCharacter) this method is called upon to set the number of movies that this Disney Character has been in to the same number of movies as the specified character (from the parameter list) Please follow and use best practices in terms of encapsulation o If you are not sure what I mean by this requirement ask me Place only the class definition in the .H file and place all of the method body code in the .CPP file Commenting the source code is not required in this exercise The Test-Harness Particulars Your testharness source code module (i.e. your main() function) is called upon to use the DisneyCharacter class interactively. In this code: o Instantiate a DisneyCharacter object called mickey (i.e. name=Mickey, creationDate=1929-01-01, numMovies=100, whichPark=M) o Instantiate a DisneyCharacter object called minnie (i.e. name=Minnie, creationDate=1930-01-01) o try setting the number of Minnies movies equal to Mickeys by calling the SameMovies() method Question: Which object (Minnie or Mickey) is this method called on and which object (Minnie or Mickey) is passed into it as a parameter? o try dumping out the objects member values by calling ShowInfo() for both Mickey and Minnie o try placing Minnie in the Epcot park.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Determine miller indices of plane A Z a/2 X a/2 a/2 Y

Answered: 1 week ago

Question

1. Write down two or three of your greatest strengths.

Answered: 1 week ago

Question

What roles have these individuals played in your life?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago