Advertisement
LettuceCookie

Celsius/Fahrenheit(Method) Table Ver. 2

Nov 2nd, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package celsiusfahrenheitmethodtable;
  2.  
  3. /**
  4.  *
  5.  * @author StoneBoneThone
  6.  */
  7. public class CelsiusFahrenheitMethodTable
  8. {
  9.  
  10.     /**
  11.      * @param args the command line arguments
  12.      */
  13.     public static void main(String[] args)
  14.     {
  15.        //Call the getCelsius method here
  16.         double theCelsius;
  17.         theCelsius= getCelsius(fahrenheit);
  18.      
  19.  
  20.       //Display the table header (MAY NOT GO HERE!!!!)
  21.       System.out.println("Celsius        Fahrenheit");
  22.       System.out.println("---------------------------");
  23.        
  24.       System.out.printf("%f\t\t%.1f\n",celsius, fahrenheit);
  25.                  
  26.        
  27.     }
  28.    
  29.    
  30.     public static double getCelsius (double fahrenheit) //This DOES need to accept fahrenheit
  31.      {
  32.         double celsius = 0;
  33.         //This is the loop that will increment fahrenheit and establish it
  34.         for (fahrenheit = 0; fahrenheit >= 20; fahrenheit ++)
  35.         {
  36.             //This is the equation for Celsius
  37.         celsius = 0.5*(fahrenheit -32); //need to figure out where fahrenehti comes in main method
  38.        
  39.         }
  40.        
  41.         return fahrenheit; // figure out; might do with main method emptiness
  42.         //May also need some sort of string for main method
  43.        
  44.      }
  45.    
  46.    
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement