Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Tasks;
- public class Thermometer {
- // static double celsius;
- // static double fahrenheit;
- // static double temperature;
- public static double fahrenheitToCelsius(double fahrenheit) {
- return (fahrenheit - 32) * 5 / 9;
- }
- public static double celsiusToFahrenheit(double celsius) {
- return (celsius * 9 / 5) + 32;
- }
- public static void main(String[] args) {
- Thermometer thermometer = new Thermometer();
- double celsius = fahrenheitToCelsius(102);
- double fahrenheit = celsiusToFahrenheit(38);
- System.out.println(celsius);
- System.out.println(fahrenheit);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement