Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have been struggling with getting the below Python code question to run. Please can i get help?# DO NOT CHANGE THE FILENAME: cat.py #

I have been struggling with getting the below Python code question to run. Please can i get help?# DO NOT CHANGE THE FILENAME: cat.py # IMPORTANT: Before you submit, make sure your program produces # the expected result as shown in the assignment description class Cat: #The Cat class must have the following: #A name attribute that is intialized when a cat is created. #An energy attribute that has an initial value of 2. #A stomach capacity attribute that has an initial value of 2. #A method called play(). If the value of energy is greater than 0, # it prints a message similar to "cat name says meow" and then reduces the value of energy by 1. # The message has to contain the name of the cat and the sound meow. # However, if the value of energy is less than or equal to 0, it prints "cat name is tired" instead. #A method called eat(). If the capacity of stomach is greater than 0, # it prints a message similar to "cat name says nom" and then reduces the capacity of stomach by 1. # The message has to contain the name of the cat and the sound nom. # However, if the capacity of stomach is less than or equal to 0, it prints "cat name is full" instead.

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

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions