Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help in python! 4.7 Program: Pets! Again In this lab, you will be updating the Pets! program. This uses your program from Chapter 3

need help in python! image text in transcribed
image text in transcribed
image text in transcribed
4.7 Program: Pets! Again In this lab, you will be updating the Pets! program. This uses your program from Chapter 3 as a base, so copy that work into this assignment as a starting point. 1. (3 pts) Create a new class called Dog in pet.py. This class should be a class derived from the Pet class. Create a class attribute in Dog for whether they are house broken (called "house") and initialize it to False (Boolean value). Your Dog constructor should take keyword parameters for dog name and age dog_age. The default value for name should be 'Spot' and for age be 1. 2. (2 pts) Override the print method in Dog to output a human-friendly version of the object/pet information Example Output Dog Sadie is 6 year(s) old, is owned by Pred, and is not house-broken 3. (1 pt) Add a method to Dog called set_house() to change the house broken value. It should take an argument of True or False 4. (3 pts) Create a new class called Beagle in pet py. This class should be a class derived from the Pet and 'Dog' class. Create a class attribute in Beagle for an integer value or ear floppiness (called "flop'). Your Beagle constructor should take keyword parameters for bg_name and bg_age, bg_house, and bg_flop. The defaults for these values should be 'Ace":3, 'yes', and 2 5. (2 pts) Override the print method in Beagle to output a human-friendly version of the object/pet information Example Output search hp Example Output Beagle Sadie is 6 year(s) old, is owned by Fred, is house-broken, and has an ear floppiness of 7 6. (1 pt) Add a method to Beagle called set flop to change the integer for ear floppiness. The only argument is an integer to for the new floppiness value 7. (3 pts) in main.py, modify the main function to test your new classes. The main function loop should prompt the user for an owner, name, age, and whether it is house broken first. It should then prompt for whether the Pet is a beagle or not. If it is ask for ear floppiness. Continue until the user enters a 'q' or 'Q. Finally, print out a list of all the current pets. Example Output: Please enter the owner's name: Debbie Please enter the pet's name: Max Please enter the pet's age: 4 Is the dog house-broken? y Is the dog a beagle? n Please enter the owner's name : Louis Please enter the pet's namot Prince Please enter the pet's age: 2 Is the dog house-broken? Is the dog a beagle? y How floppy are the ears? 7 Please enter the owner's name: Janice Please enter the pet's name: Newton Please enter the pet's age: B Type here to search 15 the dog house-broken? Y Is the dog a beagle? n please enter the owner's name: Louis please enter the pet's name: Prince Please enter the pet's age: 2 Is the dog house-broken? n Is the dog a beagle? Y How floppy are the ears? 7 Please enter the owner's name: Janice Please enter the pet's name: Newton Please enter the pet's age: 8 Is the dog house-broken? n Is the dog a beagle? n Please enter the owner's name: Dog List: Dog Max is 4 year(s) old, is owned by Debbie, and is house-broken Beagle Prince is 2 year(s) old, is owned by Louis, is not house-broken, and has an ear floppiness of 7 Dog Newton is 8 year(s) old, is owned by Janice, and is not house-broken 0/16 ACTIVITY 4.7.1: Program: Pets! Again Load default template Current file: main.py re to search

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

How does content caching differ from content delivery?

Answered: 1 week ago

Question

List the different categories of international employees. page 642

Answered: 1 week ago

Question

Explain the legal environments impact on labor relations. page 590

Answered: 1 week ago