Result
s1_id: 1234
s1_name: Karen
s1_id: 1234
s1_name: Karen
s3_id: 5678
s3_name: Tim
s3_id: 5678
s3_name: Tim
Knute Snortum wrote:Welcome to the Ranch, terry kang.
Is the code you posted yours? Normally, we don't post complete solutions but since it's been up for ten hours I'm going to leave it.
Posting complete solutions robs the OP of the experience of finding their own solutions. It is also not good for us to do the homework of others. Short snippets are okay.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 14
at java.lang.String.charAt(String.java:658)
at Main.checkDouble(Main.java:7)
at Main.main(Main.java:27)
exited with non-zero status
Knute Snortum wrote:Can you tell us what you expect the output to be or what the error is?
java.lang.AssertionError: expected:<4> but was:<45>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at p6Testing.PublicTests.testDeckDealCards(PublicTests.java:43)
Campbell Ritchie wrote:Now you need a way to shuffle your List, so you can deal randomised cards.
When Card is Odd
Expected when even # cards:
1 7 2 8 3 9 4 10 5 11 6 12
Expected when odd # cards:
1 7 2 8 3 9 4 10 5 11 6 12 13
Result: 1 7 2 8 3 9 4 10 5 11 6 12 13
Original Cards size: 13
Size of the card after top and bottom shuffle: 13
top deck size: 13
bottom deck size: 7
When Card is Odd
Expected when even # cards:
1 7 2 8 3 9 4 10 5 11 6 12
Expected when odd # cards:
1 7 2 8 3 9 4 10 5 11 6 12 13
Result: 1 7 2 8 3 9 4 10 5 11 6 12
Original Cards size: 12
Size of the card after top and bottom shuffle: 12
top deck size: 6
bottom deck size: 6
public Card[] deal(int numCards)
This method will remove the specified number of cards from the top of the deck and return them as an array. For example, if the parameter is 4, then the first four cards in the deck will be returned as an array of size 4. This is the one place in this class where an array is used. Important: The cards will be removed from the front of the "cards" ArrayList, not the back. As with the cut method, drawing some pictures and thinking about the add/remove options the ArrayList object provides will help make this a smoother section of code to design and implement. For this project you can assume only legal requests will be made.
Result
1 2 3 4 5 6
6
4
4
[1, 2, 3, 4]
java.lang.AssertionError: expected:<4> but was:<45>
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.failNotEquals(Assert.java:834)
at org.junit.Assert.assertEquals(Assert.java:645)
at org.junit.Assert.assertEquals(Assert.java:631)
at p6Testing.PublicTests.testDeckDealCards(PublicTests.java:43)