#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    37
    Rep Power
    2

    Homework help setting up something


    The code isn't correct (I know that much) but here's some info:

    I need to pass the temperatures of 80 degrees to 105 degrees through something that lets me know what the heat index is at 40, 60 and 80% humidity.

    (Heat Index Temperature = C1 + C2 * Temperate + C3 * humidity + C4 * temperature * humidity + C5 * temperature * temperature
    + C6 * humidity * humidity + C7 * temperature * temperature * humidity + C8 * temperature * humidity * humidity + C9 * temperature * temperature * humidity * humidity)

    Here's the basic's of the equation.

    And here's the variables:
    public static final int MIN_TEMPERATURE = 80; //degrees F
    public static final int MAX_TEMPERATURE = 105; //degrees
    public static final int LOW_HUMIDITY = 40;
    public static final int MED_HUMIDITY = 60;
    public static final int HIGH_HUMIDITY = 80;
    public static final double C1 = -42.379;
    public static final double C2 = 2.04901523;
    public static final double C3 = 10.14333127;
    public static final double C4 = -0.22475541;
    public static final double C5 = -6.83783E10-3;
    public static final double C6 = -5.481717E10-2;
    public static final double C7 = 1.22874E-3;
    public static final double C8 = 8.5282E-4;
    public static final double C9 = -1.99E-6;

    i've been told I need to use a loop in the main method to call this method with the specified temperature (loop control variable) and
    humidity (3 calls in the loop, one for each humidity value).

    How should I start going about this?
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,696
    Rep Power
    347
    need to use a loop in the main method to call this method
    Where are the methods defined that you are talking about?
    The code you posted just defines a bunch of variables and assigns them initial values.

    Can you post the code with the methods?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    37
    Rep Power
    2
    Originally Posted by NormR
    Where are the methods defined that you are talking about?
    The code you posted just defines a bunch of variables and assigns them initial values.

    Can you post the code with the methods?
    That's the thing. I don't know where to begin yet so I haven't set up any methods.
  6. #4
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,696
    Rep Power
    347
    Start by reading the tutorial on how to define a method:
    http://docs.oracle.com/javase/tutori...O/methods.html

    Then write the code in steps. Define a skeleton for the method,
    code a call to the method and compile that.
    Fix the errors and recompile. continue until the errors are fixed.


    When the skeleton compiles ok, then work on putting the logic in the method to do the job it is supposed todo.
    Last edited by NormR; September 15th, 2012 at 08:10 AM.

IMN logo majestic logo threadwatch logo seochat tools logo