RE: Convert to Celsius using Methods 02-05-2014, 03:16 PM
#3
i think that's what u've asked for:
Code:
package conversiontable;
public class Conversiontable {
public static int convert(int c) {
int f = (c * 9 / 5) + 32;
return f;
}
public static void main(String[] args) {
System.out.println("The following is a table that converts Celsius to Fahrenheit:");
System.out.println("Celsius Fahrenheit");
for (int c = 0; c <= 20; c = c + 1) {
System.out.println(c + " " + convert(c));
}
}
}
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)