Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default HELP PLEASE! Need reply ASAP

    There are two parts I need help with.

    Here is my code for the first method
    public static boolean isOdd (int x)
    {
    if (x%2==1)
    {
    return true;
    }
    else
    {
    return false;
    }
    }
    I declared this in a separate file than my main method and I need to know how to test it in the main method.

    2.
    public static boolean closeAccount (double acctBalance, int checksLeft) {
    if ((acctBalance < 0)||(checksLeft <= 0))
    return true;
    else
    return false;
    // returns true if acctBalance is less than zero or checksLeft is less than or equal to zero.
    }
    public static boolean closeAccount (int acctBalance, int checksLeft) {
    if ((acctBalance < 0)||(checksLeft <= 0))
    return true;
    else
    return false;

    I also need to know how to test these two methods in the main method.

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    By calling them?

    import package.Class;

    Class.method(arguments)

  3. #3
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default

    when i call the methods in the main method it returns true or false. this puts nothing in the output. I need a way to test these methods so that something happens in the output that reflects that the methods work.

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

    Default

    If you got a return value from the methods then the methods were indeed called.
    If you want to print something to the console then use
    Java Code:
    System.out.println("Look Ma, Some output!");

Similar Threads

  1. Need answer asap!!!
    By uranis_khai in forum New To Java
    Replies: 3
    Last Post: 07-07-2009, 09:48 AM
  2. Please reply to help Me ......
    By mohamed sherif in forum New To Java
    Replies: 3
    Last Post: 12-02-2008, 07:05 PM
  3. Need Java Help ASAP
    By L-dog in forum New To Java
    Replies: 22
    Last Post: 10-02-2008, 11:54 PM
  4. Same old Question please reply
    By venat123 in forum New To Java
    Replies: 1
    Last Post: 12-18-2007, 12:24 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
  •