Im trying to create a method with a calculation and then call it inside two other methods. The problem I have is that each of the other two methods are int and float respectively.
i want to create a method of this "((celsius * 9) / 5) + 32;" and then call it in overloading 1 and 2, problem is the first is int and the second is float.. CTF is the method i tried to create for this.
How do I solve this? Thanks!
// Overloading 1 - with float
public static int CelsiusToFahrenheit(int celsius)
{
int fahrenheit = ((celsius * 9) / 5) + 32;
return fahrenheit;
}
//METHOD, CelsiusToFahrenheit
//Overloading 2 - with float
public static float CelsiusToFahrenheit(float celsius)
{
int fahrenheit = ((celsius * 9) / 5) + 32;
return fahrenheit;
}
//METHOD, convert celsius to fahrenheit
static double CTF(double celsius)
{
double a = ((celsius * 9) / 5) + 32;
return a;
}