write a program in Java to assume the temperature in degree Celsius and convert it into equivalent Fahrenheit and vice versa. Display the result with proper message
Answers
Answered by
1
/* this program is convert temperature from Centigrade to Fahrenheit and vice versa */
class Temperature
{
public show(int x , int y)
double c,f;
{
c=x;
f=y;
}
public show()
{
c=0;
f=0;
}
public void convert(double centigrade)
{
f=1.8*centigrade+32;
Sytem.out.println("Fahrenheit :" +f);
}
public void change(double fahrenheit)
{
c=(fahrenheit*32)/1.8;
System.out.println("Centigrade :" +c);
}
}
class Temperature
{
public show(int x , int y)
double c,f;
{
c=x;
f=y;
}
public show()
{
c=0;
f=0;
}
public void convert(double centigrade)
{
f=1.8*centigrade+32;
Sytem.out.println("Fahrenheit :" +f);
}
public void change(double fahrenheit)
{
c=(fahrenheit*32)/1.8;
System.out.println("Centigrade :" +c);
}
}
Similar questions