Question
Please help in C++ ASAP Lab 4: use of Scope resolution in C++ Convert a structure into a class implementation. Details: Copy three files plus
Please help in C++ ASAP
Lab 4: use of Scope resolution in C++
Convert a structure into a class implementation.
Details: Copy three files plus the Makefile into your directory by entering the following commands:
cp et/data/ftp/pub/class/115/05-structure2Class/Exercise/*.* .
cp et/data/ftp/pub/class/115/05-structure2Class/Exercise/Makefile .
Modify all of the functions so that they are member functions. Use the scope resolution operator (::) to show that an implementation of a function is part of a class Change the initialization function into a constructor with arguments. Add a default constructor that initializes things to 0 or empty string. Please note that you should use a for loop to initialize all the values of furColours Add one getter to return the height. Modify the calls in main to reflect the change in the functions. Be sure to add the keyword const after functions that do not change the data. If you want, you can turn the isTaller function into an overloaded operator>. Here are two sample runs that you can try in the lab:
hercules[5]% ./main
Please decribe the cat
Please enter a length: 48
Please enter a height: 25
Please enter a tail length: 31
Please enter an eye colour: blue
Please enter a description of the fur (long, medium, short, none): short
Please enter the colours of the fur (separated by a space or a newline character). Add "done" at the end: grey white done
The average cat has height 24
-------------------------------------------------------
This is myCat: Length: 48
Height: 25
Tail Length: 31
Eye Colour: blue Fur
Classification: short
Cat Colours: grey white
My cat is taller than the average cat
hercules[6]%
hercules[6]% ./main
Please decribe the cat Please enter a length: 44 Please enter a height: 22 Please enter a tail length: 30 Please enter an eye colour: yellow Please enter a description of the fur (long, medium, short, none): long Please enter the colours of the fur (separated by a space or a newline character). Add "done" at the end: black white orange done The average cat has height 24
------------------------------------------------------- This is myCat:
Length: 44
Height: 22
Tail Length: 30
Eye Colour: yellow Fur
Classification: long
Cat Colours: black white orange
My cat is shorter than the average cat
My cat is a calico
Convert a structure into a class implementation Details: Copy three files plus the Makefile into your directory by entering the following commands: cp et/data/ftp/pub/class/115/05-structure2Class/Exercise/.. . lep et/data/ftp/pub/class/115/05-structure Class/Exercise/Makefile Modify all of the functions so that they are member functions. Use the scope resolution operator (9) to show that an implementation of a function is part of a class Change the initialization function into a constructor with arguments. Add a default constructor that initializes things to 0 or empty string. Please note that you should use a for loop to initialize all the values of furColours Add one getter to return the length. Modify the calls in main to reflect the change in the functions. Be sure to add the keyword const after functions that do not change the data. If you want, you can turn the isTaller function into an overloaded operator> Here are two sample runs that you can try in the lab: hercules [518 ./main Please decribe the cat Please enter a length: 48 Please enter a height: 25 Please enter a tail length: 31 Please enter an eye colour: blue Please enter a description of the fur (long, medium, short, none): short Please enter the colours of the Eur (separated by a space or a newline character). Add "done" at the end: grey white done The average cat has length 46 This is myCat: Length: 48 Height: 25 Tail Length: 31 Eye Colour: blue Fur Classification: short Cat Colours: grey white My cat is taller than the average cat hercules [6] hercules [6]$ ./main Please decribe the cat Please enter a length: 44 Please enter a height: 22 Please enter a tail length: 30 Please enter an eye colour: yellow Please enter a description of the fur (long, medium, short, none): long Please enter the colours of the Eur (separated by a space or a newline character). Add "done" at the end: black white orange done The average cat has length 46 This is myCat. Length: 44 Height22 Tail Length: 30 Eye Colour: yellow Pur classification: long Cat Colours: black white orange My cat is shorter than the average cat My cat is a calico MacBook Pro Convert a structure into a class implementation Details: Copy three files plus the Makefile into your directory by entering the following commands: cp et/data/ftp/pub/class/115/05-structure2Class/Exercise/.. . lep et/data/ftp/pub/class/115/05-structure Class/Exercise/Makefile Modify all of the functions so that they are member functions. Use the scope resolution operator (9) to show that an implementation of a function is part of a class Change the initialization function into a constructor with arguments. Add a default constructor that initializes things to 0 or empty string. Please note that you should use a for loop to initialize all the values of furColours Add one getter to return the length. Modify the calls in main to reflect the change in the functions. Be sure to add the keyword const after functions that do not change the data. If you want, you can turn the isTaller function into an overloaded operator> Here are two sample runs that you can try in the lab: hercules [518 ./main Please decribe the cat Please enter a length: 48 Please enter a height: 25 Please enter a tail length: 31 Please enter an eye colour: blue Please enter a description of the fur (long, medium, short, none): short Please enter the colours of the Eur (separated by a space or a newline character). Add "done" at the end: grey white done The average cat has length 46 This is myCat: Length: 48 Height: 25 Tail Length: 31 Eye Colour: blue Fur Classification: short Cat Colours: grey white My cat is taller than the average cat hercules [6] hercules [6]$ ./main Please decribe the cat Please enter a length: 44 Please enter a height: 22 Please enter a tail length: 30 Please enter an eye colour: yellow Please enter a description of the fur (long, medium, short, none): long Please enter the colours of the Eur (separated by a space or a newline character). Add "done" at the end: black white orange done The average cat has length 46 This is myCat. Length: 44 Height22 Tail Length: 30 Eye Colour: yellow Pur classification: long Cat Colours: black white orange My cat is shorter than the average cat My cat is a calico MacBook ProStep 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