APCS: Elevens Project, Activity 9

6 points 

Activity 9, on pages 31 - 33, is "Implementing the Elevens Board".
In this Activity you write the code needed to complete the Elevens game. (The code that creates the GUI will be provided to you.)
I suggest that you first write containsPairSum11(). This method returns a boolean that indicates whether or not the cards on the board contain at least 2 cards that sum to 11. I used 2 nested loops in this method.

I suggest that you next write containsJQK(). This method returns a boolean that indicates whether or not the cards on the board contain a jack, a queen and a king. I used 3 IF statements, inside a loop, in this method.

Next write isLegal(), which can call the 2 methods mentioned above and can be brief.

Finally, write anotherPlayIsPossible(). This method can also call the first 2 methods you wrote and can be brief. Note that, before calling any other methods, this method first needs to call cardIndexes() in order to generate a list of cards on the board.

You do not need to answer the questions at the end of Activity 9.

You will need to add to your project CardGameGUI.java and ElevensGUIRunner.java, available below.

You will also need to download images of playing cards, in the folder playingcards.zip, available below. You should extract these images to the same folder that contains your project's class files. If you'd like, you can store them in a folder that resides in the folder that contains your project's class files.

 

Resources:
ElevensGUIRunner.java
CardGameGUI.java
playingcards.zip
Student Guide

 

Links:
Elevens Project
AP Computer Science