Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**URGENT HELP NEEDED, please!** Could you please help me solve this python3 question? The question comes in a series of steps ; they build off

**URGENT HELP NEEDED, please!**

Could you please help me solve this python3 question?

The question comes in a series of steps; they build off of each other each time, so I'd really appreciate you answering them all. Thanks!

Step1:

This assignment will be incredibly open-ended, this is by design. I want you to have some freedom to create something that you are interested in rather than just following along with what I tell you to do. Feel free to go as far as youd like with your script, dont just stop with the bare minimum. And remember to have fun! Scripts will be graded on how much fun you have.

Create a class of your choosing. It can be an animal class or a bankaccount class. Choose something that you are passionate about and familiar with and create it. For the purposes of illustration, I will be using a dog class as an example. While I would prefer you to create your own unique class, you may use a dog class so long as you do not copy my code and you are super passionate about dogs. Your class should have the following:

- Three protected class variables to store key information about the class

- An __init__ constructor that populates the aforementioned class variables

Example structure

class Dog:

size = smol

rate = 10

name = Schmoopy

__init__(size, rate, name):

size = size

rate = 10

name = name

Step2:

Now its time to add some interactivity to your previous script. Take the class you created in the add the following:

- One method that will accept an input, update one of the class variables, and return the new value

- One method that will accept an input, perform some kind of error checking, update one of the class variables, and return the new value

Example structure

set_size(newsize):

size = newsize

return size

increment_cute(number):

if rate < 10:

rate += number

return rate

else

return false

Step3:

Now were going to add even more interactivity to your class. Building on what you have so far, you will now add the following:

- overload the str() and len() methods to return useful information for your class

- overload the equivalence operator (==) such that its use with your class will compare one of the variables and return true if they are the same and false otherwise

Example structure

__str__():

return name

__len__():

return size

__==__(otherdog):

if rate == otherdog.rate

return True

else

return False

Step4

Now its time to get some use out of your class. You will create the following:

- Define a new class that inherits from your previous class

- Override one of your methods to provide new functionality

- Define a new method specific to this class

Example structure

class RescueDog(Dog)

increment_cute(number):

if rate < 20:

rate += number

return rate

else

return false

puppy_dog_eyes():

rate += 1

return rate

Step5:

Now were going to add some more complexity to our class. You are to add the following:

- Create a new class that inherits from your original class

- Add two new private class variables

- Override the constructor to only accept these new variables

- Override one of your methods to accept a numeric value and use that in a condition

- Add a class variable that is a number

- Add a new method that will take in a number and add it to with the previously created numeric value so long as it is within a certain range

Example structure

class Pug

squishface = true

grossrating = 10

__init__(size, rate, name, squishface, grossrating):

increment_cute(number, grossrating):

if grossrating > 8:

return false

else:

rate += number

return rate

wrinkles = 25

wrinkle(newwrinkles):

if wrinkles + newwrinkles < 50:

wrinkles += newwrinkles

else:

print("That's too many wrinkles, man")

return false

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

when comapnies develop a ruptation for environmental excellence

Answered: 1 week ago