write a class named display which call a function convert of other class named temperature.The function takes celsius temperature as argument and then returns the equivalent fahrenheit value. For reference, the conversion formula in given below
Answers
Answered by
4
Answer:
import java.util.Scanner;
class CelsiustoFahrenheit
{
double fahrenheit(double c)
{
return ((9*c)/5)+32;
}
public static void main(String arg[])
{
double a,c;
Scanner sc=new Scanner(System.in);
System.out.println("Enter Celsius temperature");
a=sc.nextDouble();
CelsiustoFahrenheit cel=new CelsiustoFahrenheit( );
double result=cel.fahrenheit(a);
System.out.println("Fahrenheit temperature is = "+result);
}
}
Explanation:
Similar questions