Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

program for converting celcius to farenheit

807591Apr 2 2008 — edited Jun 3 2008
Hi below is my coding which converts euros to pounds.
import javax.swing.* ;
 
class tut3_3
 
{
   public static void main ( String[] args)
   {
 
      final double PoundToEuro = 1.478 ;
      
      String strEuros = JOptionPane.showInputDialog( "Enter amount in Euros:" ) ;
      int Euros= Integer.parseInt( strEuros ) ;
 
	  double pounds = Euros / PoundToEuro;
      
      
      
      System.out.println( Euros + " Euros = " + pounds + " pounds sterling" ) ;
 
     
   }
}

I need to convert celcius to farenheit so was just wondering if the below code looks correct, please correct me if its not.
import javax.swing.* ;

class tut3_3

{
public static void main ( String[] args)
{

final double FarenheitToCelcius = 1.478 ;

String strEuros = JOptionPane.showInputDialog( "Enter Celcius:" ) ;
int Celcius= Integer.parseInt( strCelcius ) ;

double Farenheit = Celcius / FarenheitToCelcius;



System.out.println( Celcius + " Celcius = " + Farenheit + " Farenheit" ) ;
Does anybody know what number i should put where it asks for farenheitToCelcius because i dont know the conversion number.

Please reply.

Take care bye                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 1 2008
Added on Apr 2 2008
75 comments
828 views