Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

#1
September 14th, 2012, 08:57 PM
Contributing User

Join Date: Sep 2012
Posts: 37
Time spent in forums: 11 h 30 sec
Reputation Power: 1
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).

#2
September 15th, 2012, 07:47 AM
 NormR
Contributing User

Join Date: Aug 2010
Location: SW Missouri
Posts: 2,956
Time spent in forums: 1 Week 6 Days 2 h 56 m 11 sec
Reputation Power: 345
Quote:
 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?

#3
September 15th, 2012, 07:55 AM
Contributing User

Join Date: Sep 2012
Posts: 37
Time spent in forums: 11 h 30 sec
Reputation Power: 1
Quote:
 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.

#4
September 15th, 2012, 08:07 AM
 NormR
Contributing User

Join Date: Aug 2010
Location: SW Missouri
Posts: 2,956
Time spent in forums: 1 Week 6 Days 2 h 56 m 11 sec
Reputation Power: 345
Start by reading the tutorial on how to define a method:
http://docs.oracle.com/javase/tutor...OO/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.

 Viewing: Dev Shed Forums > Programming Languages > Java Help > Homework help setting up something