The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Conversions Between Celsius and Fahrenheit

Ok, I am trying to write code to convert both celsius to fahrenheit and fahrenheit to celsius. I have to use the two methods public static double celsiusToFahrenheit(double celsius) and public static fahrenheitToCelsius(double fahrenheit) in the code. I am really lost as to where I am supposed to go in my program. I will attach my program hoping someone can help me get through this. This is only my second programming class so you will have to bear with me as I am new. Thanks for the help!

I figured out how to call on methods. When I say I need help I need all around help with the whole program. I am a junior in college and this is my second java programming class. My first one was about 6-7 months ago. I know I lack experience and knowledge! That is why I came to this website, hoping to get hopes from experiences people on how to help me complete this program. Basically I need to finish this program and be able to compile it and run it because I have one more to write tonight (that's even harder) before tomorrow.

Re: Conversions Between Celsius and Fahrenheit

You say you need to finish the program, but have yet to tell us what the requirements are. Without knowing the destination, we can't give you directions (and should we try to guess, can quite probably lead you in the wrong direction). Did you read the suggested reading link I posted above?

Re: Conversions Between Celsius and Fahrenheit

Originally Posted by baueml01

What I have finished so far will not compile in cmd.

There are some syntax errors in the code you posted above, but I would first say to break the problem down. Concentrate on one requirement at a time. I would say strip out all code of the class, then build back up - take the first method to convert C to F

Where has fahrenheit been declared (the compiler must know what the variables are)? Further, you might want to check the formula for this. It oftentimes helps to write out on paper how you would accomplish this, then move that to code. Try writing this method only - without the other pieces of code. Make sure it compiles before moving forward. Post back if it does not