A Java Course Outline
Using the Java By Dissection book
by Ira Pohl and Charlie McDowell

 


Solution to Homework 2 - Centigrade
Good indenting, good comments for variables though it may have been better just to give
them more descriptive names. Nice output.


//Grant Vesely 

//This program will translate a set of intervals (0-100) 
//from Centigrade to Fahrenheit and print them as a table
//Homework problem 2


public class Centigrade
{
   public static void main (String [ ] args)
   {
      double c; //c is the variable in centrigrade
      double F; // F is the anwser in Fahrenheit

      for (c=0; c <= 100; c=c+5)  {
         F= 9.0/5.0*c + 32;
         System.out.println ("The centigrade value is "+c+" ,and tbe answer in Fahrenheit is "+F);
      }
      System.out.println ("Table is complete");
   }
}

Feel free to report any site problems to the Webmaster, Debra Dolsberry.