0039: import java.io.BufferedReader; // Convert.java
0040: import java.io.InputStreamReader; import java.io.IOException;
0041: public class Convert { /* BJC 960603 */
0042: public static void main(String[ ] args) throws IOException {
0043: System.out.println("type in the lowest Fahrenheit value");
0044: BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
0045: int lower = Integer.parseInt(input.readLine());
0046: System.out.println("type in the number of lines: ");
0047: int numOfLines = Integer.parseInt(input.readLine());
0048: int upper = lower + numOfLines - 1;
0049: for (int fahrenheit = lower; fahrenheit <= upper; fahrenheit++ ) {
0050: float celsius = to_celsius(fahrenheit);
0051: System.out.println(fahrenheit + " F is " + celsius + " C");
0052: }
0053: }
0054: // function to convert a temperature from degrees Fahrenheit
0055: // to degrees Celsius
0056: private static float to_celsius(float fahr) {
0057: return (fahr - 32.0F)*5.0F/9.0F;
0058: }
0059: }