tens
Tens
This combines Click Boxes Application with the Elevens lab. This game will have the user remove all the tiles by selecting two tiles that add up to 10. To make it harder, the two tiles must be neighbors. Tens Starter Code
- In the
Tensclass, complete theresetTiles()method so it constructs newTileobjects and placed it in thetilesArrayList - Complete subclass of Light called Tile. It needs a new instance variable called
digitthat has a number from 1 to 9. You can make a Font object and set the Font in java with something likesetFont (new Font (“TimesRoman”, Font.BOLD | Font.ITALIC, 20)); - You need to write accessor methods, and a new
drawmethod that calls the super class's draw method, and draws the digit in the Tile. - Complete the
removemethod of theTensclass. Now we need to have to see if there are two selected, that if the tiles add up to 10, they are removed, and if they do not,messagewill have a error message and all the tiles are tuned off. - (optional) Design your own version- different numbers and a different total; or make sure the user always win; or you can only click boxes that neighbor each other; etc.
tens.txt · Last modified: 2020/04/23 14:19 by frchris