# Temperature Table Celsius and Fahrenheit

• January 31st, 2012, 11:12 PM
Krodfish
Temperature Table Celsius and Fahrenheit

I need to Create a program that takes three inputs from the command line arguments. The inputs will need to be a starting and ending temperature and a step to increment by. For example, if the inputs were 1 5 1 the program would print a table with Fahrenheit temperatures (and their Celsius equivalent) for the temperatures 1, 2, 3, 4, 5. If the inputs were 2 10 2 the Farenheit temperatures would be: 2, 4, 6, 8, 10.
The program will convert temperatures from Fahrenheit to Celsius. The program will start at the starting temperature that was entered as a command line argument. Then the program will loop through all the Farenheit temperatures (incrementing by step on each loop iteration) until the program reaches the ending temperature that was specified as the second command line argument.
Your program should print out a Header line and then print out the Farenheit temperature and the corresponding Celsuis temperature on one line. For example:
Farenheit Celsius
212.0 100.0
The Farenheit temperature in your calculation can be an integer data type, but the Celsius temperature will need to be a floating point data type to ensure that the decimal digits are accurate.

Quote:

package temperature.table;

public class TemperatureTable {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int far, cel;
int lower, upper, step;
lower = 0;
upper = 200;
step = 15;
far = lower;

System.out.print("Fahrenheit\tCelsius");

while ( far <= upper )
{
cel = 5 * (far -32) /9;
System.out.println(far);

System.out.println (" ");

System.out.println (cel);
far = far + step;
}
}
}
This is my first time developing a Java system, I have never done one before. I've been trying to do this all week and this is as far as I got. Please help me.
• February 1st, 2012, 08:24 AM
KevinWorkman
Re: Temperature Table Celsius and Fahrenheit
What have you tried? Where are you stuck? Recommended reading: http://www.javaprogrammingforums.com...e-posting.html
• February 2nd, 2012, 09:06 PM
Krodfish
Re: Temperature Table Celsius and Fahrenheit