![]() ![]() Unfortunately this code has a magic number which should be replaced by a constant with a meaningfull name: private static final int TOP_POSITION = 0 This also would remove the need to track the number of cards left since you can call isEmpty() on any Collection. Then the whole method dealNextCard() would reduce to: private final List deck = new ArrayList() Since order is important you man use an implementation of List. You may better use a Collection type to hold them. Because of this you need to "move" the cards in the deck after getting the top most. Public void getPlayerHand(boolean hideCard) while (!input.equalsIgnoreCase("Yes") & !input.equalsIgnoreCase("No")) TotalSum = totalSum + countSum.getFace() I am reading my first course in Java, have that in mind. I will post my code so feel free to come with criticism etc. ![]() The reason why I decided to do this specific project was to improve my object orientated programming in java. I've created a relatively simple Blackjack game in java. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |