Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#16
January 23rd, 2013, 02:16 PM
 TTG123
Registered User

Join Date: Dec 2012
Posts: 21
Time spent in forums: 6 h 26 m 27 sec
Reputation Power: 0
Quote:
 Originally Posted by NormR See post #12 for 2 possible solutions.

Normally I would do that but I can't assign them to values, I need to do it in the way that I'm comparing the Strings.

#17
January 23rd, 2013, 02:59 PM
 NormR
Contributing User

Join Date: Aug 2010
Location: SW Missouri
Posts: 3,614
Time spent in forums: 2 Weeks 3 Days 7 h 4 m 42 sec
Reputation Power: 347
Quote:
 I need to do it in the way that I'm comparing the Strings

Why? That is a very cumbersome way to do it.
With java 1.7 a switch statement could be used to assign a value to a suit.

#18
January 23rd, 2013, 03:06 PM
 TTG123
Registered User

Join Date: Dec 2012
Posts: 21
Time spent in forums: 6 h 26 m 27 sec
Reputation Power: 0
Quote:
 Originally Posted by NormR Why? That is a very cumbersome way to do it. With java 1.7 a switch statement could be used to assign a value to a suit.

I know, it would make much more sense to do it with a Switch statement or the other ways that you have suggested but it says specifically that it's to be done.

#19
January 23rd, 2013, 03:13 PM
 TTG123
Registered User

Join Date: Dec 2012
Posts: 21
Time spent in forums: 6 h 26 m 27 sec
Reputation Power: 0
I have my logic written here but it's just trying to convert it into code.

If this card is a diamond then its the largest else

If this card is a club and the largest card is a heart or a spade then this card is the largest else

If this card is a heart and the largest card is a spade then this card is the largest

All other conditions means that the largest card is the same as thus card

#20
January 23rd, 2013, 03:35 PM
 NormR
Contributing User

Join Date: Aug 2010
Location: SW Missouri
Posts: 3,614
Time spent in forums: 2 Weeks 3 Days 7 h 4 m 42 sec
Reputation Power: 347
How does the logic you just posted initialize largest card?
If this card is not a diamond, what happens?

 Viewing: Dev Shed Forums > Programming Languages > Java Help > Total an ArrayList