Python Computer Science - Project 9 Class
Project 9 – Class
Please Zip Up project 9 folder and reference the project template attached below. The instructions for this project is also attached below
Write a program that implements class structure.
- Class Structure:
- The data attributes
- The class should have constructor that assigns the data attributes to blank
- The methods for the class
The name of the class is Pet
name (the name of a pet)
animalType (the type of animal. Example ‘Dog’, ‘Cat’, ‘Bird’)
age (for the pet’s age)
setName - This method assigns a value to name
setAnimalType - This method assigns a value to animalType
setAge - This method assigns a value to age.
setGender – This method assigns the gender
getName - This method returns the value of the name.
getAnimalType - This method returns the value of the animalType.
getAge - This method returns the value of the age.
getGender – This method returns the gender
- The program creates an object of the class
- The user enters the name, type, and age of his or her pet. T
- The program stores the data as the object’s attributes.
- The program uses methods to save and retrieve the pet’s name, type, and age and display this data on the screen with appropriate labels.
SAMPLE RUN (User entry is in RED)
Enter the Pet’s name Scooby
Type of Pet (Dog, Cat, Bird) Cat
Age of the Pet(years) 2
Gender of the Pet(male/female) Male
The name of the Pet is Scooby
It is a cat.
It is 2 years old.
It is Male