Results 1 to 4 of 4
  1. #1
    soc86 is offline Member
    Join Date
    Oct 2008
    Posts
    39
    Rep Power
    0

    Default if statement with multiple inputs?

    Can any body help me on the line i have highlighted, how do i word my if statement if i have multiplte inputs?


    public static void main (String[]args){

    int wheelRad;
    int fSprocket;
    int rSprocket;
    int eRad;

    System.out.println("Please enter the wheel radius");
    wheelRad = UserInput.readDouble;

    System.out.println("How many teeth are on the front sprocket?");
    fSprocket = UserInput.readInt;

    System.out.println("How many teeth are on the rear sprocket?");
    rSprocket = UserInput.readInt;


    if (eRad, fSprokcet, rSproket <=0) {
    System.out.println("message Error, invalid value and do not let your program continue.");

    if else (eRad >= 0) {

    eRad = wheelRad*fSprocket/rSprocket;

    System.out.println("The effective radius for raduis "+wheelRad+" and sprockets "

    }


    }//end main

    }//end class

  2. #2
    xcallmejudasx's Avatar
    xcallmejudasx is offline Senior Member
    Join Date
    Oct 2008
    Location
    Houston, TX & Flint, MI
    Posts
    609
    Rep Power
    6

    Default

    use and ( || ).
    example:

    if( (eRad <= 0) || (fSprokcet <= 0) || (rSproket <= 0)){
    do stuff;
    }
    Liberty has never come from the government.
    Liberty has always come from the subjects of government.
    The history of liberty is the history of resistance.
    The history of liberty is a history of the limitation of governmental power, not the increase of it.

  3. #3
    soc86 is offline Member
    Join Date
    Oct 2008
    Posts
    39
    Rep Power
    0

    Default

    thanks!!!!!

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. temperature program with inputs
    By JingGong in forum New To Java
    Replies: 3
    Last Post: 10-17-2008, 06:34 PM
  2. Delay on inputs during calculation
    By matt_well in forum New To Java
    Replies: 14
    Last Post: 07-26-2008, 04:17 PM
  3. Replies: 2
    Last Post: 07-18-2008, 01:13 PM
  4. How to create this if many inputs?
    By sarahannel123 in forum New To Java
    Replies: 3
    Last Post: 05-18-2008, 04:22 PM
  5. Date Inputs
    By hiranya in forum AWT / Swing
    Replies: 3
    Last Post: 11-06-2007, 05:11 PM

Posting Permissions

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