/**
 * Format a table of temperature conversions, using String format,
 * shown using some static methods and fields
 *
 * @author CSCI209
 */
public class TemperatureTableStatic {
    
    /** Format of the headings for the table */
    private static String headingFormat = "%10s %10s %10s";
    
    /** Format of the data for the table */
    private static String tempFormat = "%10.1f %10.1f %10.1f";

    /**
     * Prints the heading of the temperature table.
     */
    public static void printHeading() {
        String headings = String.format(headingFormat, "Temp C", "Temp F", "Temp K");
        String lines = String.format(headingFormat, "------", "------", "------");
    
        System.out.println(headings);
        System.out.println(lines);

    }

    /**
     * Prints the given data in nice format
     * param temps an array of 3 temperatures
     */
    public static void printData(double[] temps) {
        System.out.println(String.format(tempFormat, temps[0], temps[1], temps[2]));

    }

    public static void main(String[] args) {
        // Note: it would be better to have the values calculated rather than 
        // hardcoded, but our focus right now is on formatting.
        double[] temps = {-459.7, -273.1, 0.0};
        double[] temps2 = {0.0, -17.8, 255.4};
        double[] temps3 = { 32.0, 0.0, 273.1};
	
        printHeading();
        printData(temps);
        printData(temps2);
        printData(temps3);
    }
    
}
