Please answer this in python. It is creating methods. Add the following four methods to your Crew class: move(self, location): This takes in a location as a string, along with self, and attempts to move the crew member to the specified location. If location is one of the five valid location options ("Bridge", "Medbay", "Engine", "Lasers", or "Sleep Pods"), then this should change self.location to that new value. Otherwise, the function should print out the message: Not a valid location. repair(self, ship): first_aid(self, ship): fire_lasers(self, ship, target_ship, target_location): The above three methods represent tasks that a ba

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please answer this in python. It is creating methods.

Add the following four methods to your Crew class:

  • move(self, location):
  • This takes in a location as a string, along with self, and attempts to move the crew member to the specified location.  If location is one of the five valid location options ("Bridge", "Medbay", "Engine", "Lasers", or "Sleep Pods"), then this should change self.location to that new value.
  • Otherwise, the function should print out the message:

Not a valid location.

  • repair(self, ship):
  • first_aid(self, ship):
  • fire_lasers(self, ship, target_ship, target_location):
    • The above three methods represent tasks that a basic Crew member is not capable of (but one of its derived classes will be able to accomplish).  So each of them should simply print out a message of the form:

<Name> doesn't know how to do that.

Examples:

Copy the following if __name__ == "__main__" block into your hw12.py file, and comment out tests for parts of the class you haven’t implemented yet.  

 

if __name__ == '__main__':

    crew1 = Crew('Sakshi')

    crew2 = Crew('Jina')

    crew3 = Crew('Daniel')

    space_boat = Starship('Ebon Hawk', [crew1, crew2, crew3])

    print(space_boat.name) #Ebon Hawk

    print(space_boat.crew_list) #[Sakshi : Active, at Sleep Pods, Jina : Active, at Sleep Pods, Daniel : Active, at Sleep Pods]

    print(space_boat.damaged) #{'Bridge': False, 'Medbay': False, 'Engine': False, 'Lasers': False, 'Sleep Pods': False}

    

    crew1.move('Dungeon') #Not a valid location.

    print(crew1.location) #Sleep Pods

    crew1.move('Engine')

    print(crew1.location) #Engine

    crew2.repair(space_boat) #Jina doesn't know how to do that.

    crew3.first_aid(space_boat) #Daniel doesn't know how to do that.

    crew2.fire_lasers(space_boat, space_boat, "Engine") #Jina doesn't know how to do that.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY