View Single Post
  #3 (permalink)  
Old 01-07-2008, 09:45 PM
CaptainMorgan's Avatar
CaptainMorgan CaptainMorgan is offline
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 841
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Code:
switch(menuChoice) { /*case 1: showPlayerScores(tempArray); <-- uncomment this break;*/ case 2: showAllScores(tempArray); break; default: System.out.println("Not A valid choice."); break; } } public static void showAllScores(int[][] tempArray) { for(int p=0; p < tempArray.length; p++) { for(int r=0; r < tempArray[p].length; r++) { System.out.println("Player "+(p+1)+" Round "+(r+1)+": "+tempArray[p][r]); } } } public static void showPlayerScores(int[][] tempArray) { Scanner keyboard = new Scanner(System.in); System.out.println("Show scores for which player?"); int whichPlayer = keyboard.nextInt(); <-- your problem is from here on* for(int p=0; p < tempArray[p].length; p++) { for(int r=0; r < tempArray[p].length; r++) { System.out.println("Player "+(p+1)+" Round "+(r+1)+": "+tempArray[p][r]); } } }
showPlayerScores is really no different from showAllScores, minus a few lines. You ask for which player and even read it in from the keyboard, but you don't put it to use. In essence, you're making a call to two methods which perform basically the same function, with the array. If I haven't been clear, post back.
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on September 4, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Reply With Quote