Advertisement
Timur69

Project

Mar 30th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. package Tasks;
  2.  
  3. public class Thermometer {
  4.     // static double celsius;
  5.     // static double fahrenheit;
  6.     // static double temperature;
  7.  
  8.     public static double fahrenheitToCelsius(double fahrenheit) {
  9.         return (fahrenheit - 32) * 5 / 9;
  10.  
  11.  
  12.     }
  13.  
  14.     public static double celsiusToFahrenheit(double celsius) {
  15.         return (celsius * 9 / 5) + 32;
  16.  
  17.     }
  18.  
  19.     public static void main(String[] args) {
  20.         Thermometer thermometer = new Thermometer();
  21.         double celsius = fahrenheitToCelsius(102);
  22.         double fahrenheit = celsiusToFahrenheit(38);
  23.  
  24.         System.out.println(celsius);
  25.         System.out.println(fahrenheit);
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement