User Profile
Collapse
-
creating a stack of objects with proper constructors?
I'm using a Linked list stack with objects. I figured out the reason for my earlier problem (where I couldn't access "rank" and "suit" from one of the objects in my stack), and it was because my object didn't have the attributes "rank" and "suit". Turns out my earlier cards were practically just strings. Can anyone help me create a whole deck of cards represented by 52 objects in a linked list stack with the... -
Thank you everyone for your very helpful replies. ^^ I was able to shuffle the cards now using the shuffle() algorithm. Our instructor accepted this method of shuffling the cards since the overall project is solitaire. -
Again, I apologize. I've read all the guidelines now, and I'll be sure to remember the guidelines the next time....Leave a comment:
-
Thank you. ^_^ But I'm pretty sure you haven't given me this tip yet, as it is the first time I've read or heard of it....Leave a comment:
-
I'm sorry, was I not supposed to do that? :( I'll remember the next time.
And can you tell me what an OP is?...Leave a comment:
-
It simply prints the multiplication table of 10. Its output would be:
Hello, World
10 x 0 = 0
10 x 1 = 10
10 x 2 = 20
10 x 3 = 30
10 x 4 = 40
10 x 5 = 50
10 x 6 = 60
10 x 7 = 70
10 x 8 = 80
10 x 9 = 90
The int variable i are the numbers which are being multiplied to 10. The value of the variable i rises because of the step expression...Leave a comment:
-
I've figured out how to use Math.random() package, but is there a way to make the generated numbers unique? For example, I only need numbers from 0 to 51. Can you tell me how I generate one random number only once so that in the end, it seems like I'm rearranging the numbers 0 to 51 in a random sequence?...Leave a comment:
-
oh wait, so does that mean I'm creating the stacks properly? (Sorry, I'm being completely difficult. I only have little idea of what I'm doing.)...Leave a comment:
-
oh gosh, I'm so sorry, I'm a total noob. I had thought that what I posted was my card class, and I also didn't post any main method. was I doing it completely wrong? I'm really sorry....Leave a comment:
-
oh, unfortunately,w e're actually required to use the stacks. is there any way you can help me out with that?...Leave a comment:
-
how to use multiple stacks?
I can't figure out how to make and handle multiple stacks and use them so I could create four linked list stacks representing each suit of cards, one stack each for diamonds, hearts, spades, and clubs. I use objects as my cards. I don't know how to make more than one stack.
Can anyone help me out? If I'm not being clear, I'll be happy to clarify the problem I have.
here is the class I used to make the Objects... -
-
"cannot be applied to ()" error?
I'm trying to make an object to represent a single playing card. Like if it's an EIGHT of HEARTS, the object should be "8 H". Here is what I came up with, but I keep getting the error message,
"DisplayDeck.ja va:12: switchRank(int) in DisplayCards cannot be applied to ()
sRank = dispCards.switc hRank();" .
The error points out the dot in "dispCards.switchRank()".
Can... -
Okay, thanks very much. I'll try it and post what I come up with as soon as I can, because as of yet I still haven't figured out how to make the objects (cards)....Leave a comment:
-
How to randomize?
I'm just starting learning Java, and we have a project that needs to demonstrate shuffling playing cards. We're using objects as our playing cards, and we've put these objects in stacks, and I wonder if anyone can help me how to "shuffle" these objects or put them in a random arrangement?
No activity results to display
Show More
Leave a comment: