How to Display Products in a table format?

Java Table Question - Celsius Conversion?

  • I'm writing a program that displays a table of the Celsius temperatures 0 through 20 and their Fahrenheit equivalents. The problem I have is that I don't know how to use the JOptionTable class, and that's the way my professor wants it. It's in systemprintln right now, but I'm stuck on how to change it to a table using the joptiontable class. import java.text.DecimalFormat; public class TempTable { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub DecimalFormat C = new DecimalFormat("#0.0"); DecimalFormat F = new DecimalFormat("#0.0"); System.out.print("We will display a table of the Fahrenheit tempertures" + "\n0 through 32 and their Celsius equivalents.\n"); System.out.println("Fahrenheit" +"\t\t" + "Celsius"); System.out.println("--------------------… for (double fahrenheit = 0; fahrenheit <= 32; fahrenheit++) { System.out.println(F.format(fahrenheit) + "\t\t" + C.format(celsius(fahrenheit))); } } public static double celsius(double fahrenheit) { return (fahrenheit-32) * .55555; } }

  • Answer:

Rob at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.