52 Java Create New Class Called Temperature Main Method Include Following Methods Inside I Q37045156

5.2 Java. Create a new class called Temperature (with no mainmethod), and include the following methods inside it instead:

  1. A method to convert the temperature from Celcius to Fahrenheit.Formula: (0°C × 9/5) + 32 =32°F
  2. A method to convert the temperature from Fahrenheit to Celcius.Formula: (32°F − 32) × 5/9 =0°C

For both of these methods, they should take 1 parameter, andreturn a value

Then create a class called Demo, which does include the mainmethod, and test out both of your methods from the Temperatureclass


Solution


public class Temparature { public double ctoF(double c){ return (c *9 /5) + 32;

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.