Results 1 to 3 of 3
  1. #1
    scottmulla is offline Member
    Join Date
    Mar 2011
    Posts
    10
    Rep Power
    0

    Exclamation private int method - if statement

    hi there, i am trying to write this code so that it returns who is winning.

    All other required methods, code etc has been written and compiles fine.

    M, stands for me
    C, stands for computer

    Java Code:
    	private int displayWinnerNo(int currentScoreM, int currentScoreC) {		
    		int number = 0;
    		if (currentScoreC > 21 && currentScoreU <= 21) {
    			number = 1;
    		} if (currentScoreU > 21 && currentScoreC <= 21) {
    			number = 2;
    		} if (currentScoreU == currentScoreC) {
    			number = -1;
    		return number;
    however it will not compile, giving me a heap of errors.

    any help much appreciated thanks.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    your last if

    Java Code:
    } if (currentScoreU == currentScoreC) {
    opens a bracket which is not closed?

  3. #3
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

Similar Threads

  1. Replies: 7
    Last Post: 06-28-2010, 07:52 AM
  2. private static setter method problem
    By kyussy in forum New To Java
    Replies: 7
    Last Post: 01-27-2010, 04:02 PM
  3. More than one input in one private method
    By rice in forum New To Java
    Replies: 0
    Last Post: 10-02-2009, 05:08 AM
  4. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 08:37 AM
  5. Private main method
    By bugger in forum New To Java
    Replies: 1
    Last Post: 12-21-2007, 09:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •