
Create a Pet class that contains the following properties: A species (cat, dog, hamster, etc) an age, and an age_factor that represents the average lifespan of the animal compared to humans. (for example, the average lifespan of a hamster is about 2 years. the average human lives a little longer than 70 years, so we will divide 70 by 2. 1 human year = 35 hamster years)
Create the following methods: A constructor, getters and setters, and a humanYears method that will return how old the animal is in human years.
Finally, in your Main program, instantiate three different animals using your Pet class. A dog (agefactor = 7), A hamster (agefactor = 35) and some other animal (you can make up the age factor if you wish) Print out how old each of the animals is in human years.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.