Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Existing Code: def __str__(self): return 'Account Number: {}, Balance: ${:,.2f}'.format(self.account_number, self.balance) # returns banks balance def __len__(self): return self.balance # checks two account number are

Existing Code:

 def __str__(self): return 'Account Number: {}, Balance: ${:,.2f}'.format(self.account_number, self.balance) # returns banks balance def __len__(self): return self.balance # checks two account number are same or not def __eq__(self, other): if self.account_number == other.account_number: return True else: return False def main(): # create 2 objects of BankAccount class acct1 = BankAccount('ACC_123', 100.00) acct2 = BankAccount('ACC_124', 500.00) acct1.deposit(100) # deposit 100, acct1.withdraw(150) # withdraw 150 print(acct1) # balance = 100+100-150 = $50 acct2.withdraw(900) # withddraw more than balance acct2.deposit(-100) # deposit negative amount print(acct2) # print the account number and balance # checks two account are same or not? print('Account1==Account2?',acct1==acct2) main()-

Task 04 (30 points)

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

Task 05 (30 points)

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

Task EC (Up to 15 points)

A security script?? What fools! No one may stop the mighty DOCTOR DOOM from accessing the satellite broadcasting system. Ill show those bumbling do-gooders that it is DOOM who will be victorious. You will use what you have learned in this section in order to create a script that will run the so called security script created by those overzealous oafs and get access to the satellite broadcasting system. DESTROY THE ONLY THING STANDING BETWEEN DOOM AND COMPLETE POWER OVER ALL THE WORLDS SATELLITE BASED MEDIA BROADCASTING. Soon the whole world will hear the message of DOOM!!!

Yikes, he seems pretty heated. Better do what he says. Try using import to run the extra credit script from the previous section and see if you can crack it! Points will be awarded for most creative solution

Example input

Expected output of script

./scriptcracker.py script.py

0 digits correct

1 digits correct

2 digits correct

3 digits correct

Access granted!

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

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions

Question

2. Identify and choose outcomes to evaluate a training program.

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago