Advertisement
fozlerabbi2

Convert Celsius to Fahrenheit

Jan 30th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. /*
  2.  Convert Celsius to Fahrenheit  
  3.  */
  4. package lab1;
  5.  
  6. import java.util.Scanner;
  7.  
  8. /**
  9.  *
  10.  * @author CSE_IT
  11.  */
  12. public class Lab1 {
  13.  
  14.     /**
  15.      * @param args the command line arguments
  16.      */
  17.     public static void main(String[] args) {
  18.     System.out.print("Enter temprature in Celcius:");
  19.     Scanner scan =new Scanner(System.in);
  20.     double a;
  21.         a = scan.nextDouble();
  22.     Lab1 obj= new Lab1();
  23.     double b= obj.converter(a);
  24.     System.out.println(b);
  25.             }    
  26.    
  27.     double converter(double cel){
  28.        
  29.         double temp=((cel/5)*9)+32;
  30.         return temp;
  31.     }
  32.    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement