Module 8 - Lab - Pet Class

 Objective

Create a Class called Pet and include the following attributes (3 string data types)

  1. Name

  2. PetType (this would be something like Dog, Cat, Bird, etc. )

  3. Sound

Constructors/Getters/Setters/Functions

  1. Constructor - 3 arguments - name, pet type, and sound

  2. Getters/Setters for all three attributes

  3. PrintPet method/function that will print the attributes such as:

Name: Fluffy
Type: Cat
Sound: Meow

 

Program User prompts:

  1. Name

  2. PetType (this would be something like Dog, Cat, Bird, etc. )

  3. Sound

 

Program requirements

  1. Main program to demonstrate the class. (Your main Method)

  2. Pet.h file (or hpp depending on your IDE)

  3. Pet.cpp file

  4. You will need to prompt the user for the Pet information to populate the Pet class attributes. Once you have the data - create a Pet and hand the variables to the 3 Argument Constructor.

  5. Output of the values of the attributes Pet instance as shown above

 Deliverables

Upload the following files in a zip folder that you have created:

  1. C++ code files (3 files - the Pet.cpp, Pet.h and your main program file)

  2. Screenshot of the Console with the code executing

COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark