I have an assignment due in my Java class in a few days, it is an intro to programming class and this is our first programming assignment 
Anyways, what we had to do was create a program that we could enter a temperature in Celcius and comvert it to Fahrenheit. I wrote this, and it runs fine. Please understand we have not gotten into the whole negative and invalid number thing yet, just the basics... Does this look okay for my first assignment? Don't mind all the commenting, it is required in the class...
Anything I can do to clean this up, or should I turn it in as is?
I am under the impression that I can ask for opinions on stuff like this for my homework... just not ask you guys to write it for me
Thanks
Anthony
Anyways, what we had to do was create a program that we could enter a temperature in Celcius and comvert it to Fahrenheit. I wrote this, and it runs fine. Please understand we have not gotten into the whole negative and invalid number thing yet, just the basics... Does this look okay for my first assignment? Don't mind all the commenting, it is required in the class...
code:<HR>Code://Program to convert from Celcius to Fahrenheit. <P> //Java extension packages import javax.swing.JOptionPane;<P> public class temperature{<P> //start main method public static void main (String args[]) { double dblTemp_C; //variable for Temperature in Celcius double dblTemp_F; //variable for Temperature in Fahrenheit String strTemp_C; //string entered by user showing Temperature in Celcius //read in the temperature in celcius from the user as a string strTemp_C = JOptionPane.showInputDialog ("Enter the current Celcius Temperature"); //convert number from type string to double dblTemp_C= Double.parseDouble(strTemp_C); //Calculate Fahrenheit Temperature dblTemp_F = (9/5) * dblTemp_C + 32; //Display the results JOptionPane.showMessageDialog(null, "Your Temperature in Fahrenheit is " +dblTemp_F, "Results", JOptionPane.PLAIN_MESSAGE); System.exit(0);<P> }//ends the method main<P>}//ends the class temperature
Anything I can do to clean this up, or should I turn it in as is?
I am under the impression that I can ask for opinions on stuff like this for my homework... just not ask you guys to write it for me
Thanks
Anthony