Question
This lab involves writing a program that will model two types of pets: cats and dogs. Pets have a name, a weight (in pounds), and
This lab involves writing a program that will model two types of pets: cats and dogs. Pets have a name, a weight (in pounds), and an age (in years). Pets can also make a sound...cats make a "meow" sound and dogs make a "bow wow" sound. The program should prompt the user to enter information for several different types of pets. It should create the appropriate class instances for each type of pet and store the objects in a single array. The program should then iterate through the array and display the pet attributes and the sound that each pet makes. The program should not check for the type of object in the array.
Step 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