Ask your own question, for FREE!
Computer Science 13 Online
OpenStudy (anonymous):

Hello, I'm trying to write a console Java program here. I prompt the user for whether they want to convert from Celsius to Fahrenheit or Fahrenheit to Celsius. Then I do the conversion from which method they told me to use and print out the result. I was having lots of compiler errors before that I've fixed, but when I finally run it, nothing actually gets converted and printed. Here's my code: http://pastebin.com/UZhCg2Tu

OpenStudy (anonymous):

For some reason, the 'temp' variable isn't being read by calc_celsius or calc_faren methods. I'm not sure why.

OpenStudy (anonymous):

hey you are not specifying data type in printf statement , use %f before your C and F . Moreover in calc_celsius , there should be F not C because the answer is in Fahrenheit and similarly in calc_faren. there is another way too , you can remove printf statements and use println statements they show the right result too.

OpenStudy (anonymous):

Ok, that's what it was. It seems to run fine now, and thanks for pointing out the mixup, now output makes sense :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!