Question: Using the promptInt method in class Global, a constructor for class PlayerShip reads input from the user and initialises the position field. Your code should

Using the promptInt method in class Global, a constructor for class PlayerShip reads
input from the user and initialises the position field. Your code should provide the String Player position: as a parameter to method promptInt. (Note that in the String there is
a space after the colon.) The following is an example of what this I/O looks like when the constructor executes (the bold and underlined text indicates the users input):
The PlayerShip constructor also creates two guns with power 5, with the first gun immediately one position to the left of the player ship, and the second gun immediately one position to the right of the player ship.
 Using the promptInt method in class Global, a constructor for class

* Write a description of class PlayerShip here * author (your name) :vsi version nunber or a date) public class PlayerShip // instance variables replace the example below with your own private int position; private Gun gun1: private Gun gun2 public Playership() // initialise instance variables position Global.promptInt(" player position:")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!