1 Trek Wars Purpose: classes, inheritance, class diagramsDescription Universal Merriment Development (UMD) is creating an online space battle game called (Trek Wars). You are tasked with...

1 answer below »


Trek Wars








Purpose: classes, inheritance, class
diagrams
















Description







Universal Merriment Development (UMD) is
creating an online space battle game called (Trek Wars). You are tasked with
creating some classes for this game. You just have to just write the classes
and test it, not the whole game. A description of the classes is given below:




1 Trek Wars Purpose: classes, inheritance, class diagrams Description Universal Merriment Development (UMD) is creating an online space battle game called (Trek Wars). You are tasked with creating some classes for this game. You just have to just write the classes and test it, not the whole game. A description of the classes is given below: Figure 1: Graphics from the game. enum Alignment{us, them, chaotic}; Ship (the base class) attributes name : string alignment : Alignment x_location : int y_location : int range: int current_health : int attack_power: int max_health: int methods __init__(name:string, x : int , y : int , alignment : Alignment , max_health : integer, range :int, attack_power : int ) attack(target: Ship) : None # does attack_power damage to the target ship if it is within range get_type() : string #’’Battleship’’, ’’Cruiser’’, ’’Corvette’’, ’’Repairship’’ get_x():int # returns the x coordinate get_y():int # returns the y coordinate get_alignment():Alignment # returns the alignment status () : string # see format below move() : None # changes position by the amount of that type of ship and increases health by 1 (until max reached) change_alignment() : None # changes the alignment. # us changes to them, them changes to - chaotic never changes assess_damage(amount : int) : None # changes the health by amount, keeping it within bounds [0,maxHealth] 2 Battleship(derived from the Ship class) range is 10, max_health =100 ,attack_power = 10, attributes torpedoes = 10 methods move() #always moves along the vector (-1, -1) attack(target: Ship ) : None # attacks and fires ( if torpedo >0 it does an additional 10 damage, 1 less torpedo ) status () : string # also indicates number of torpedoes Cruiser (derived from Ship class) range is 50, max_health =50, attack_power = 5 methods move() : None # always moves along the vector (1, 2) attack(target: Ship) : None Corvette (derived from Ship class) range is 25, max_health =20 methods move() : None # always moves along the vector (5, 5) attack(target: Ship ) : None # Everyone loves corvettes so their attack # flips ships in range to its state (if self is us, turns them to us, if self is them, turns us to them) # change_alignment Repair (derived from Cruiser class) range is 25, max_health = 20 methods attack(target: Ship ) : None # its attack repairs a ship of own kind to max health Input No input Output For status() return a string: type: health: location: (xLoc, yLoc) torpedoes: # only if this is a battleship Except for repair ships, attacks only work if the target of the attack is of the opposite alignment and in range. By opposite alignment, it means (us attacks them and them attacks us). Chaotic ships attack everyone. Repair ships only attack (in this case repair), ships of the same alignment. What to turn in Submit a UML diagram and code, including UnitTests for 100% code coverage
Answered 4 days AfterJan 21, 2023

Answer To: 1 Trek Wars Purpose: classes, inheritance, class diagramsDescription Universal Merriment...

Vikas answered on Jan 21 2023
35 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here