Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 Create a class called Enemy that has class variables damage _ multiplier, an int, and armor _ bonus, an int. The value for

Problem 3
Create a class called Enemy that has class variables damage_multiplier, an int, and armor_bonus, an int. The value for damage_multiplier can
be hardcoded to 3 and the value for armor_bonus can be hardcoded to 10.
The Enemy class should also have instance variables hp and base_damage. You should define a constructor that optionally takes two ints
corresponding to hp and base_damage. If no arguments are supplied, those values should default to 30 and 2 respectively.
Sample usage:
koopa = Enemy ()
print (koopa.hp)
30
print (koopa.base_damage)
2
Enemy.damage_multiplier
3
Enemy.armor_bonus
10
king_koopa =Enemy(50,6)
print(king_koopa.hp)
50
print(king_koopa.base_damage)
6
image text in transcribed

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

Graph Databases In Action

Authors: Dave Bechberger, Josh Perryman

1st Edition

1617296376, 978-1617296376

More Books

Students also viewed these Databases questions

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago