Write a static method for SpacePirate called formNewCrew. Th…
Write a static method for SpacePirate called formNewCrew. The method takes two parameters – an array of SpacePirates that will form the new crew and a String representing the new crew’s spaceship – and it returns nothing. For every SpacePirate in the given array, the method should update its associated spaceship and crewSize. The method should finally print: “The crew of the [spaceship] has been created”.
Read DetailsWrite a constructor for Pirate. The constructor will take th…
Write a constructor for Pirate. The constructor will take the name, bounty, and gold, and set all instance variables appropriately. If the bounty or gold is negative, set the instance variables to 0 instead. The constructor should also update the pirateCount variable to reflect that a new Pirate exists. Note: even though the class is abstract, this doesn’t affect anything on the constructor. You can treat the class as any concrete class in this particular question.
Read DetailsWrite a concrete toString method for Pirate. The String repr…
Write a concrete toString method for Pirate. The String representation of a Pirate is “My name is [name], and the bounty on my head is [bounty]. I have [gold] gold to my name” (without the square brackets, replacing the square brackets with the values from the indicated instance variables).
Read DetailsWrite the class header and the variable declarations (a clas…
Write the class header and the variable declarations (a class without constructors or methods, with correct syntax) for SpacePirate (a concrete class, child of Pirate). The class has the following variables: crewSize (int) spaceship (String)
Read Details