Back in the 90s, there was a popular toy called a Giga Pet, a digital pet...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Back in the 90s, there was a popular toy called a Giga Pet, a digital pet that you could care for and raise. We can create our own version of a Giga Pet using Python classes. Create a class PyPet with at least the following methods (feel free to add your own): . _init_(self) Create a PyPet • care(self) Take care of the egg until it hatches, user should give the egg words of encouragement feed(self) Feed your pet status(self) Check whether your pet is hungry Your PyPet class should also track several attributes of your pet, at a minimum: • hatched whether your egg has hatched • hatched_time the time when your egg hatched • start the time your pet was created • validation number of times you have cared for your pet • last_fed the time your pet was last fed • times_fed total times your pet has been fed • level level of pet • name name of pet Your egg should hatch after criteria based on both the times it has been cared for as well as total time you have had the egg. Your pet should level up after criteria based on time owned and times fed. Implement your PyPet class in a program that allows the user to raise their own PyPet. In []: from time import time In [] class Pypet: definit__(self): self.name=input('What is the name of your pet? ') self.created_time = time() self.hatched = False def status (self): self.total_time = time () - self.created_time if (not self.hatched) & (self.total_time > 30): print (Congratulations, your egg has hatched! '). self.hatched = True self.hatched_time = time () if not self.hatched: print('{.0f} seconds have elapsed since you got your egg'.format(self.total_time)) print('{:.0f} seconds have elapsed since your egg hatched'.format(time() - self.hatched_time)). else: In [] pet1 = PyPet() Back in the 90s, there was a popular toy called a Giga Pet, a digital pet that you could care for and raise. We can create our own version of a Giga Pet using Python classes. Create a class PyPet with at least the following methods (feel free to add your own): . _init_(self) Create a PyPet • care(self) Take care of the egg until it hatches, user should give the egg words of encouragement feed(self) Feed your pet status(self) Check whether your pet is hungry Your PyPet class should also track several attributes of your pet, at a minimum: • hatched whether your egg has hatched • hatched_time the time when your egg hatched • start the time your pet was created • validation number of times you have cared for your pet • last_fed the time your pet was last fed • times_fed total times your pet has been fed • level level of pet • name name of pet Your egg should hatch after criteria based on both the times it has been cared for as well as total time you have had the egg. Your pet should level up after criteria based on time owned and times fed. Implement your PyPet class in a program that allows the user to raise their own PyPet. In []: from time import time In [] class Pypet: definit__(self): self.name=input('What is the name of your pet? ') self.created_time = time() self.hatched = False def status (self): self.total_time = time () - self.created_time if (not self.hatched) & (self.total_time > 30): print (Congratulations, your egg has hatched! '). self.hatched = True self.hatched_time = time () if not self.hatched: print('{.0f} seconds have elapsed since you got your egg'.format(self.total_time)) print('{:.0f} seconds have elapsed since your egg hatched'.format(time() - self.hatched_time)). else: In [] pet1 = PyPet()
Expert Answer:
Related Book For
Modern Systems Analysis And Design
ISBN: 9780134204925
8th Edition
Authors: Joseph Valacich, Joey George
Posted Date:
Students also viewed these programming questions
-
Dale, a 40 year old single taxpayer, incurs medical expenses for the year as follows: Medical insurance premiums: $11,000 Doctors and hospital fees: $3,500 Hearing aids : $ 350 General purpose...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
7:14 pm Sun 21 Mar < moodle.uowplatform.edu.au Expected return FIN 223 Investment Analysis Tutorial 3 Portfolio Theory 1. How does the level of risk aversion affect the curvature of indifference...
-
(a) Calculate the maximum increase in photon wavelength that can occur during Compton scattering. (b) What is the energy (in electron volts) of the lowest-energy x-ray photon for which Compton...
-
Jessica is a U.S. Army Reservist and in 2019 traveled 130 miles each way to serve duty at a local military installation. She was required to report four times in 2019. Her normal route from home to...
-
A milk processing unit claims that, of the processed milk converted to powdered milk, \(95 \%\) does not spoil. Find the probabilities that among 15 samples of powdered milk (a) all 15 will not...
-
Martinez Manufacturing Inc. showed the following costs for last month: Direct materials ....... $7,000 Direct labor ......... 3,000 Manufacturing overhead ... 2,000 Selling expense ........ 8,000...
-
Pick any product that is sold in local Canadian market and you are planning to sell it in a country of your choice. Please elaborate on how you will decide on following factors: 1) Adaption method...
-
Reconsider Problem 9.3. Suppose now that the demand at each of the destinations has been reduced by 10, so that the new demands are 20, 30, and 20 at destinations 1, 2, and 3, respectively. Introduce...
-
Aussie Infonautics, Inc., produces handheld Windows CE-compatible organizers. Aussie Infonautics markets three different handheld models; PalmPro is a souped-up version for the executive on the go,...
-
Explain why you think there are so many different types of gender theories .
-
What are some strategies for building quality into projects? What are some types of documentation that must be maintained for projects? What are the characteristics of good documents?
-
In each of the following studies, (i) State whether the study is experimental or observational; (ii) State whether the study is comparative or description; (iii) If the study is comparative, identify...
-
Please provide a journal entry for this transaction ES es are charged on ted goods. Children's books are subject to e HST at 13% is les of other ms. 18 19 17 It Again 4-A Charity Blvd. Toronto, ON...
-
Let E1 and E2 be equivalence relations on some set A. (a) Is E UE2 an equivalence relation on A? (b) Is E E2 an equivalence relation on A?
-
A North Carolina real estate broker is managing an apartment community. occupancy has dropped by 80% and the broker needs to attract more tenants. Which of the following actions made a broker...
-
Read the following description and Write a response of it. The discretion of public administrators can be decreased, but not altogether eliminated. Officials will use their discretion in any given...
-
Which of the four phases of the project management processdo you feel is most challenging? Why?
-
Consider the Is_married_to unary relationship in Figure 8.14c. a. Assume that we want to know the date on which a marriage occurred. Augment this E-R diagram to include a Date_married attribute. b....
-
Summarize the problems with the reliability and usefulness of analyzing business documents as a method for gathering information requirements. How could you cope with these problems to effectively...
-
A flow of nitrogen is discharged from a duct with \(M_{2}=0.85, T_{2}=500^{\circ} \mathrm{R}\), and \(p_{2}=28\) psia. The temperature at the inlet is \(560^{\circ} \mathrm{R}\). Compute the pressure...
-
Consider the flow of a perfect gas along a Fanno line. Show that the pressure at the * reference state is given by the relation 1/2 m 2RT, P Ayge(y+1)
-
Air enters a duct with a mass flow rate of \(35 \mathrm{lbm} / \mathrm{sec}\) at \(T_{1}=520^{\circ} \mathrm{R}\) and \(p_{1}=20 \mathrm{psia}\). The duct is square and has an area of \(0.64...
Study smarter with the SolutionInn App