CS 232 - Lab #6 - Pets Ahoy! We have recently been discussing the creation of classes in C++. Recall that classes serve as a "template" for the objects in our program, and that when we instantiate a class, we are creating an object which models the properties and behaviors of real-world objects. For this assignment, design and implement a parent class to represent a pet and several small sub-classes of the most common pets for cats, dogs, birds, and turtles. Each pet object is characterized by a type, name, birth date, owner, weight, sex, speak, and color. The variable data type for the type variable is a string that identifies the type of pet as a "dog", "cat", "bird", "turtle". The name is a string that identifies the name of the pet. The owner variable is a string that designates the name of the pet's owner. The weight specifies the pet's weight in pounds and is a double value. The speak variable is a string that holds an onomatopoeia of the sound the animal makes when it “speaks” such as bark! bark! for a dog. Meow! Meow! for a cat, etc. The color variable is the color of the animal’s hide/feathers/skin/or fur coat. Your pet class will need to have the following methods: Constructors: You need a default constructor that accepts no parameters but assigns to each of the characteristic instance variables a default value. You will also need a second constructor that assigns the type, name, birth date, owner, weight, sex, speak, and color. speak: You will need to declare one method called speak() that accepts no parameters. Each pet will speak in their own way that is appropriate for the particular pet type for any of the child classes listed above as dog, cat, bird, or turtle. getTag: This method returns a string that says, "If lost, call " and concatenates the name of the pet's owner to the string prior to returning this string to the caller of this object's instance function. toString: This method returns a string that outputs information about the pet in the following format: Name: Shadow Type: Dog Birth Date: 1/13/2013 Owner: Karen Weight: 42.6 Sex: Male Color: Black For other examples of C++ class definitions, please review Week #10 Canvas Lecture PowerPoint, Notes, and Examples. The driver class containing your main method for this lab assignment must create objects of each pet type named above (dog, cat, bird, etc.) and test all of the methods outlined above in these instructions. Test one object at a time within your main method to keep your code orderly and self-documenting. Make sure you test each pet object’s methods completely to ensure everything works properly for this lab assignment prior to your submission. You will need to submit your source code file containing your driver code and your class source code files to the same submission. You should submit everything in one submission either as an zip archive file or as multiple cpp files. Keep a copy of this code for yourself as it may prove useful to you on a later assignment.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
CS 232 - Lab #6 - Pets Ahoy! We have recently been discussing the creation of classes in C++. Recall that classes serve as a "template" for the objects in our program, and that when we instantiate a class, we are creating an object which models the properties and behaviors of real-world objects. For this assignment, design and implement a parent class to represent a pet and several small sub-classes of the most common pets for cats, dogs, birds, and turtles. Each pet object is characterized by a type, name, birth date, owner, weight, sex, speak, and color. The variable data type for the type variable is a string that identifies the type of pet as a "dog", "cat", "bird", "turtle". The name is a string that identifies the name of the pet. The owner variable is a string that designates the name of the pet's owner. The weight specifies the pet's weight in pounds and is a double value. The speak variable is a string that holds an onomatopoeia of the sound the animal makes when it “speaks” such as bark! bark! for a dog. Meow! Meow! for a cat, etc. The color variable is the color of the animal’s hide/feathers/skin/or fur coat. Your pet class will need to have the following methods: Constructors: You need a default constructor that accepts no parameters but assigns to each of the characteristic instance variables a default value. You will also need a second constructor that assigns the type, name, birth date, owner, weight, sex, speak, and color. speak: You will need to declare one method called speak() that accepts no parameters. Each pet will speak in their own way that is appropriate for the particular pet type for any of the child classes listed above as dog, cat, bird, or turtle. getTag: This method returns a string that says, "If lost, call " and concatenates the name of the pet's owner to the string prior to returning this string to the caller of this object's instance function. toString: This method returns a string that outputs information about the pet in the following format: Name: Shadow Type: Dog Birth Date: 1/13/2013 Owner: Karen Weight: 42.6 Sex: Male Color: Black For other examples of C++ class definitions, please review Week #10 Canvas Lecture PowerPoint, Notes, and Examples. The driver class containing your main method for this lab assignment must create objects of each pet type named above (dog, cat, bird, etc.) and test all of the methods outlined above in these instructions. Test one object at a time within your main method to keep your code orderly and self-documenting. Make sure you test each pet object’s methods completely to ensure everything works properly for this lab assignment prior to your submission. You will need to submit your source code file containing your driver code and your class source code files to the same submission. You should submit everything in one submission either as an zip archive file or as multiple cpp files. Keep a copy of this code for yourself as it may prove useful to you on a later assignment.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education