You are viewing our Forum Archives. To view or take place in current topics click here.
- Forum Archives Index
- Search
- Search found 774 matches
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306@Imp
Nevermind I fixed it. I forgot to put in the check to see if C was greater than largest in the first place. *facepalm*. It works perfectly now and I can't thank you enough!- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306it compiles correctly but gives the wrong answer- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306Is this correct so far?
public Card findLargest(){
Card largest = null;
if (null == largest){
largest = c;
}
for (Card c:pack)& ...- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306Quick question, how do I set largest as the first card in the pack?- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306I know that largest is still null here and I'm invoking getNumber()on null which is throwing the NullPointerException. It's just trying to sort it out.- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306I've made a big breakthrough, I now have this:
public Card findLargest(){
Card largest = null;
for (Card c:pack){
;
if (c.getNumber() ...- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306How is this?
public Card findLargest(){
Card largest;
Card c;
for (int i = 0; i < pack.size(); i++){
if (c.getNumber() > largest.g ...- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306Is it along these lines or have I done this completely wrong?
public Card findLargest(){
Card largest;
Card c;
for (int i = 0; i < pack.size(); i++){
i ...- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306Spades > Hearts > Clubs > Diamonds
You need to build a nested IF statement started from as you have Diamonds then follow the logic down
If this card is a diamond then its the largest el ...- 0useful
- 0not useful
-
Topic: Find the largest card in the pack? Java help.
-
-Patman
-
Replies: 25
Views: 6,306I have the structure of my method, it's just trying to get it to work. It should look like this:
public Card findLargest() {
Card largest;
Card c;
for (int i = 0; i < ...- 0useful
- 0not useful
- Forum Archives Index
- Search
- Search found 774 matches
You are viewing our Forum Archives. To view or take place in current topics click here.