Our first converter!
The convertCelsiusToFahrenheit(int celsius) method accepts a value in degrees Celsius. The method should convert the temperature and return the value in degrees Fahrenheit.
The Celsius temperature (TC) and the Fahrenheit temperature (TF) are related by the following relationship:
TC = (TF - 32) * 5/9.
Consider this example:
A value of 41 is passed to the convertCelsiusToFahrenheit method.
Example output:
105.8
Requirements:
1. The convertCelsiusToFahrenheit(int) method must be public and static.
2. The convertCelsiusToFahrenheit method must return a double.
3. The convertCelsiusToFahrenheit method should not display anything.
4. The convertCelsiusToFahrenheit method must correctly convert degrees Celsius to degrees Fahrenheit and return the result.
Farenheit Coverter? How to sove this? Anybody there?
Resolved
Comments (9)
- Popular
- New
- Old
You must be signed in to leave a comment
SAGEBRUSH SPARROW
1 March 2019, 11:14
int TC = celsius;
double TF = ((1.8 * TC) + 32);
return TF;
double is just like a decimal which is more precise
+2
Suhas Digambare Frontend Developer
9 October 2018, 07:50
Use this in conveter method to get rid off:
int TC = celsius;
double TF = 0;
TF = ((1.8 * TC) + 32);
return TF;
+10
Augustine Yanthan
12 October 2018, 07:55
wonderful....
0
Shivam Singh
16 January 2019, 14:39
Can you explain further about this code???
it worked though....but i did not get it....see if you can help me out...
0
Will Irvin
12 April 2019, 03:48
Suhas you rock! I completely forgot about initializing TF!!!!
0
Ankush Rajput
5 October 2018, 12:20useful
What's the problem ? Share your code.
+2
Hephzibah Jeyashankar
5 October 2018, 13:29
Thank you so much for your response. I got the answer. Thanks a lot.
0
Ashish RajAnand
7 October 2018, 12:20
please help me
0
Ankush Rajput
7 October 2018, 12:25
What help you need ?
Explain your problem and share your code.
0