• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Incrementer Issue: Card Shuffler

 
Ranch Hand
Posts: 99
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all:

I am writing a program that can shuffle a deck of cards in different ways. I'm having some trouble in getting the program to imprint suites from one set of 13 to the next. I had it working yesterday. Now all of a sudden it will just print everything all clubs. *scratching head*.

Can anyone help me and point out where the problem is? Any help will be greatly appreciated.
Here is the code I have created below so far....



Thanks again in advance.

S.T.
 
Saloon Keeper
Posts: 15484
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam,

Hint: What does the very first statement within your for loop do?

Anyway, why aren't you separating responsibilities?
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sam Thompson wrote:Can anyone help me and point out where the problem is? Any help will be greatly appreciated.


This won't answer your question specifically, but the fact is that StringsAreBad, so I'd strongly suggest that you think of some other way of defining your suits and values.

Oddly enough, the JLS contains an example of just what you want that uses enums. Usually it's pretty dry, but in this case it's actually better than the tutorial example IMO.

Winston
 
reply
    Bookmark Topic Watch Topic
  • New Topic