Question

T_N919_1 what is polymorphism, give and example? write a Java class to calculate temperature conversion to degree. O celcius
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is code:

import java.util.Scanner;

public class Temperature {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter celsius : ");

double celsius = sc.nextDouble();

double fahrenheit = (1.8 * celsius) + 32;

System.out.println("Celsius to F => " + fahrenheit);

System.out.print("\nEnter kelvin : ");

double kelvin = sc.nextDouble();

double celsiusCon = kelvin - 273.15;

System.out.println("Kelvin to C => " + celsiusCon);

}

}

Output:

Enter celsius: e Celsius to F-32.0 Enter kelvin : 0 Kelvin to C--273.15

Add a comment
Know the answer?
Add Answer to:
T_N919_1 what is polymorphism, give and example? write a Java class to calculate temperature conversion to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and...

    In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and kelvin, but i am stuck at how to return the proper result without chage the frame, and I cnould not figure out how to use those three settemp method. import java. uti1. Arrays public class Temperature different scale names/ public static Stringll scales -Celsius", "Fahrenheit", "Kelvin private double temperature private char scale; public Temperature (double temp temp 273. 15; this. scale-C if (temp <-273....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT