In python 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: 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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

In python

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 3 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education