The Giant Panda Protection and Research Center in the Sichuan province of southwest China, actually employs a category of workers known as panda nannies. The primary responsibility is to play with adorable panda cubs and name them, determine gender, keep track of their age and hours they sleep. So being a programmer panda nanny, you will create a code that will do all these works for you. 1. Create a class named Panda and also write the constructor. 2. Access the instance attributes and print them in the given format. 3. Call instance methods to keep track of their daily hours of sleep. 4. Suppose consulting with other panda nannies you have set some criteria based on which you will make their diet plans. The criteria are: ** Mixed Veggies for pandas having 3 to 5 hours (included) of sleep daily. ** Eggplant & Tofu for pandas having 6 to 8 hours (included) of sleep daily. ** Broccoli Chicken for pandas having 9 to 11 hours (included) of sleep daily. Lastly if no arguments are passed then just give it bamboo leaves. Now handle this problem modifying the method designed to keep track of their daily hours of sleep and determine diet plan using method overloading. ** [You are not allowed to change the code below] #Write your code here for subtasks 1-4. OUTPUT: panda1 = Panda("Kunfu", "Male", 5) panda2=Panda("Pan Pan","Female",3) panda3=Panda("Ming Ming","Female",8) Kunfu is a Male Panda Bear who is 5 years old Pan Pan is a Female Panda Bear who is print(") is a {} Panda Bear who is {} years old". format(panda1.name panda1.gender panda1 age)) 3 years old Ming Ming is a Female Panda Bear who is 8 years old Pan Pan sleeps 10 hours daily and should have Broccoli Chicken Kunfu sleeps 4 hours daily and should have Mixed Veggies Ming Ming's duration is unknown thus should have only bamboo leaves print(") is a {} Panda Bear who is {} years old". format(panda2.name,panda2.gender,panda2.age)) print(") is a {} Panda Bear who is {} years old". format(panda3.name panda3 gender panda3 ag e)) print("=== print(panda2.sleep(10)) print(panda1.sleep(4)) print(panda3.sleep()) =")

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

#pyhton programing

topic: Introduction to Method and Designing class

Method overloading & Constructor overloading

 


------------------

please find the attached image

Question 3
The Giant Panda Protection and Research Center in the Sichuan province of southwest
China, actually employs a category of workers known as panda nannies. The primary
responsibility is to play with adorable panda cubs and name them, determine gender,
keep track of their age and hours they sleep. So being a programmer panda nanny, you
will create a code that will do all these works for you.
1. Create a class named Panda and also write the constructor.
2. Access the instance attributes and print them in the given format.
3. Call instance methods to keep track of their daily hours of sleep.
4. Suppose consulting with other panda nannies you have set some criteria based
on which you will make their diet plans. The criteria are:
** Mixed Veggies for pandas having 3 to 5 hours (included) of sleep daily.
** Eggplant & Tofu for pandas having 6 to 8 hours (included) of sleep daily.
** Broccoli Chicken for pandas having 9 to 11 hours (included) of sleep daily.
Lastly if no arguments are passed then just give it bamboo leaves.
Now handle this problem modifying the method designed to keep track of their daily
hours of sleep and determine diet plan using method overloading.
**
[You are not allowed to change the code below]
#Write your code here for subtasks 1-4.
OUTPUT:
panda1 = Panda("Kunfu", "Male", 5)
panda2=Panda("Pan Pan","Female",3)
panda3=Panda("Ming Ming","Female",8)
Kunfu is a Male Panda Bear who is 5
years old
Pan Pan is a Female Panda Bear who is
3 years old
Ming Ming is a Female Panda Bear who is
8 years old
print("{} is a {} Panda Bear who is {} years
old". format(panda1. name panda1.gender panda1.age)
Pan Pan sleeps 10 hours daily and
should have Broccoli Chicken
Kunfu sleeps 4 hours daily and should
have Mixed Veggies
Ming Ming's duration is unknown thus
should have only bamboo leaves
print("{} is a {} Panda Bear who is {} years
old". format(panda2.name,panda2.gender,panda2.age))
print("{} is a {} Panda Bear who is {} years
old".format(panda3.name, panda3 gender panda3.ag
e)) print("===
print(panda2.sleep(10))
print(panda1 sleep(4))
print(panda3.sleep(0)
Transcribed Image Text:Question 3 The Giant Panda Protection and Research Center in the Sichuan province of southwest China, actually employs a category of workers known as panda nannies. The primary responsibility is to play with adorable panda cubs and name them, determine gender, keep track of their age and hours they sleep. So being a programmer panda nanny, you will create a code that will do all these works for you. 1. Create a class named Panda and also write the constructor. 2. Access the instance attributes and print them in the given format. 3. Call instance methods to keep track of their daily hours of sleep. 4. Suppose consulting with other panda nannies you have set some criteria based on which you will make their diet plans. The criteria are: ** Mixed Veggies for pandas having 3 to 5 hours (included) of sleep daily. ** Eggplant & Tofu for pandas having 6 to 8 hours (included) of sleep daily. ** Broccoli Chicken for pandas having 9 to 11 hours (included) of sleep daily. Lastly if no arguments are passed then just give it bamboo leaves. Now handle this problem modifying the method designed to keep track of their daily hours of sleep and determine diet plan using method overloading. ** [You are not allowed to change the code below] #Write your code here for subtasks 1-4. OUTPUT: panda1 = Panda("Kunfu", "Male", 5) panda2=Panda("Pan Pan","Female",3) panda3=Panda("Ming Ming","Female",8) Kunfu is a Male Panda Bear who is 5 years old Pan Pan is a Female Panda Bear who is 3 years old Ming Ming is a Female Panda Bear who is 8 years old print("{} is a {} Panda Bear who is {} years old". format(panda1. name panda1.gender panda1.age) Pan Pan sleeps 10 hours daily and should have Broccoli Chicken Kunfu sleeps 4 hours daily and should have Mixed Veggies Ming Ming's duration is unknown thus should have only bamboo leaves print("{} is a {} Panda Bear who is {} years old". format(panda2.name,panda2.gender,panda2.age)) print("{} is a {} Panda Bear who is {} years old".format(panda3.name, panda3 gender panda3.ag e)) print("=== print(panda2.sleep(10)) print(panda1 sleep(4)) print(panda3.sleep(0)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY