a. In Chapters 10 and 11, you created an Alien class and Martian and Jupiterian classes that descend from it. Add a draw() method for each child class. The draw() method accepts a Graphics object and x- and y- starting coordinates. The method draws the Aliens in any way you choose, using lines, ovals, rectangles, and so on. Using the drawString() method, include a description that names each drawing. Save the files as Martian.java and Jupiterian.java.
b. Create an applet that instantiates a Martian and a Jupiterian. In the applet’s paint() method, draw each type of Alien. Save the file as JDemoAliens.java. Figure 17-25 shows some sample Aliens, but your Aliens might look very different.
c. Create an applet that contains an Alien Hunt game. Place eight numbered buttons in the applet. Randomly assign Martians to six of the buttons and Jupiterians to two. (Hint: You do not need to create an Alien array; you can simply create an array that randomly contains 0s and 1s, representing Martians and Jupiterians.) The object of the game is to find all the Martians before finding both Jupiterians. When a user clicks a button, display the Alien represented by the button. If the user clicks two Jupiterians before clicking six Martians, the player loses the game. When this happens, display two Jupiterians and a message telling the user that Earth has been destroyed. Disable any button after it has been selected. Save the game as JAlienHunt.java.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.