![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
This is the output I'm getting:
Queen of spades is dealt with 51 cards left. Seven of spades is dealt with 50 cards left. Six of spades is dealt with 49 cards left. Four of diamonds is dealt with 48 cards left. Ace of spades is dealt with 47 cards left. Seven of diamonds is dealt with 46 cards left. Five of spades is dealt with 45 cards left. Queen of diamonds is dealt with 44 cards left. Jack of hearts is dealt with 43 cards left. Seven of clubs is dealt with 42 cards left. Three of spades is dealt with 41 cards left. Jack of spades is dealt with 40 cards left. King of clubs is dealt with 39 cards left. Eight of clubs is dealt with 38 cards left. Two of spades is dealt with 37 cards left. King of spades is dealt with 36 cards left. Ten of spades is dealt with 35 cards left. Two of hearts is dealt with 34 cards left. Eight of spades is dealt with 33 cards left. Two of clubs is dealt with 32 cards left. Nine of hearts is dealt with 31 cards left. Six of clubs is dealt with 30 cards left. Three of clubs is dealt with 29 cards left. King of hearts is dealt with 28 cards left. Nine of clubs is dealt with 27 cards left. Ace of diamonds is dealt with 26 cards left. Queen of clubs is dealt with 25 cards left. Three of diamonds is dealt with 24 cards left. Seven of hearts is dealt with 23 cards left. Ten of diamonds is dealt with 22 cards left. Jack of diamonds is dealt with 21 cards left. Five of diamonds is dealt with 20 cards left. Two of diamonds is dealt with 19 cards left. Five of clubs is dealt with 18 cards left. Ace of clubs is dealt with 17 cards left. Six of hearts is dealt with 16 cards left. Jack of clubs is dealt with 15 cards left. Queen of hearts is dealt with 14 cards left. Five of hearts is dealt with 13 cards left. Nine of diamonds is dealt with 12 cards left. Nine of spades is dealt with 11 cards left. Four of clubs is dealt with 10 cards left. Six of diamonds is dealt with 9 cards left. Ten of clubs is dealt with 8 cards left. Eight of diamonds is dealt with 7 cards left. Ace of hearts is dealt with 6 cards left. Ten of hearts is dealt with 5 cards left. Four of hearts is dealt with 4 cards left. Four of spades is dealt with 3 cards left. King of diamonds is dealt with 2 cards left. Eight of hearts is dealt with 1 cards left. Three of hearts is dealt with 0 cards left. Also, in the toString() if you want to clean it up a bit and not use all those if-else statements, you could use two instances of TreeMap or two parallell arrays (I think that's what they're called) and the code would be a bit neater. It was just easier for me to copy and paste, though, so that's why I'm using the if-else statements in case you were wondering.
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
#12 | |
|
Programmer
Join Date: Jan 2006
Location: Dallas, TX
Posts: 49
Rep Power: 0
![]() |
Quote:
Scanner input = new Scanner( System.in ); value = Keyboard.readInt(); value = input.nextInt(); ArrayList's will take ints, but they are implicitly converted to Integers. This is called autoboxing. Anytime you pass a priitive value to an ArrayList, it will box it into the corresponding object pair (int-Integer, float-Float, boolean-Boolean, etc). If you want to specify a particular type, you can do so (in jdk 1.5+) by using generics. So an ArrayList that takes int or Integer values would look like this: ArralyList<Integer> list = new ArrayList<Integer>(); |
|
|
|
|
|
|
#13 | |
|
Programmer
Join Date: Jan 2006
Location: Dallas, TX
Posts: 49
Rep Power: 0
![]() |
Quote:
list.isEmpty() |
|
|
|
|
|
|
#14 |
|
Programmer
Join Date: Jan 2006
Location: Dallas, TX
Posts: 49
Rep Power: 0
![]() |
You might also consider creating enum types for the rank of a card and the suit of a card.
|
|
|
|
|
|
#15 | |
|
The Supreme Ruler
![]() Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6
![]() |
Quote:
__________________
"Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children." - Dwight D. Eisenhower |
|
|
|
|
|
|
#16 |
|
Expert Programmer
|
Sorry if my ways seem unusual its just I have not been taught how to use "Scanners" thats all.
__________________
|
|
|
|
|
|
#17 | |
|
Programmer
Join Date: Jan 2006
Location: Dallas, TX
Posts: 49
Rep Power: 0
![]() |
Quote:
__________________
Java Blog |
|
|
|
|
|
|
#18 |
|
Expert Programmer
|
From now on I will put a link to the site that you can get that at as soon as i find that site again
![]()
__________________
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|