Hi,
I just realized that the version I sent you has some
logic error(s). Please disregard the previous version.
This copy will accomplish all your requirements with
the exeption that it does not handle Exception (maybe
is not required at this point).
Good Luck 
Manuel
/**
  This program is written to convert temperatures from
  and also Celsius to Fahrenheit or from Fahrenheit to
Celsius and
  to print a range of temperatures that you want.
  */
  import javax.swing.*;
 
  public class TempConv

  {

       private static boolean isLargest(int firstNumb,
int secondNumb) {
           
           if (firstNumb > secondNumb) {
              return false;
           }else {
              return true;
           }
           
       }




        public static void main(String[] args)
        {
              String  temp;
              int      tempC, tempF, temp2, sTemp,
eTemp;
              double  temp1, degreesC, degreesF;
              String  degrees,startTemp, endTemp;
             
              temp =
JOptionPane.showInputDialog("Enter any temperature
(either Celsius or Farhenheit that you would like 

to convert");
              temp1 = Double.parseDouble(temp);
             
              degrees =
JOptionPane.showInputDialog("Enter C to convert
Celsius or F Fahrenheit.");
                  
                  if (degrees.equalsIgnoreCase("c")) {
                     degreesF = temp1;
                     degreesC = 5 * (degreesF - 32)
/9;
                    
JOptionPane.showMessageDialog(null, degreesF + "
Fahrenheit = " + degreesC + " Celsius");
                  }
                  else if (
degrees.equalsIgnoreCase("f"))  {
                      degreesC = temp1;
                      degreesF = ( 9 * (degreesC) / 5
) + 32;
                      JOptionPane.showMessageDialog
(null, degreesC + " Celsius = " + degreesF + "
Fahrenheit.");
                  }  
                 
                  startTemp =
JOptionPane.showInputDialog("Enter a whole number
starting tempterature.");
                  endTemp =
JOptionPane.showInputDialog("Enter a whole number
ending temperature higher than the starting 

temperature.");
             
                  degrees =
JOptionPane.showInputDialog("To convert to Celsius
enter C and to convert to Fahrenheit enter 

F");
              
                 //Convert numbers from type String to
type int
                 sTemp = Integer.parseInt(startTemp);
                 eTemp = Integer.parseInt(endTemp);
                 temp2 = 0;

                 JTextArea outputTextArea = new
JTextArea();
                 
                 temp2 = sTemp - eTemp;

                 while (true) {
                         if (isLargest(sTemp,eTemp)) {
                             break;
                                                      
       
                         }
                         startTemp =
JOptionPane.showInputDialog("Your starting temperature
is: " +temp2 + 
                         " above your ending
temperature. \n" + "Please choose another number lower
than: " + endTemp);
                         sTemp =
Integer.parseInt(startTemp);
                  }
          

                 if ((sTemp <= eTemp) &&
(degrees.equalsIgnoreCase("c"))) {
                    
                    //loop to print the range temp
                    for (int i=sTemp; i <= eTemp; i++)
{
                        
                        tempC = 5 * ( i - 32 ) / 9;
                        outputTextArea.append(i + " F
= " + tempC + " C \n");
                                  
                    }
                   
JOptionPane.showMessageDialog(null,outputTextArea,"List
of 

Temperatures",JOptionPane.INFORMATION_MESSAGE);
                    System.exit(0);   // exit system
                 }

   
                 else if ((sTemp <= eTemp) &&
(degrees.equalsIgnoreCase("f"))) {
                    //loop to print the range temp
                    for (int i=sTemp; i <= eTemp; i++)
{
                        tempF = ( 9 * (i) / 5) + 32;
                        outputTextArea.append(i + " C
= " + tempF + " F \n");
                       
                    }
                   
JOptionPane.showMessageDialog(null,outputTextArea,"List
of 

Temperatures",JOptionPane.INFORMATION_MESSAGE);
                    System.exit(0);   // exit system
                }
               
                   
        }

  }





> > 
> > I am very new to Java programming and I am taking
> > courses online 
> > through the University of Maryland. I need help
> > figuring out how to 
> > fix the problem in one of the programs I am
> writing.
> > I am entering 
> > the program in JCreator and when I go to compile
> the
> > program I get 
> > an error message of incompatiable types. How do I
> > fix this? Here is 
> > the file:
> > /**
> >  This program is written to convert temperatures
> > from
> >  and also Celsius to Fahrenheit or from Fahrenheit
> > to Celsius and 
> >  to print a range of temperatures that you want.
> >  */
> > import javax.swing.*;
> > 
> > public class TempConv
> > {
> >     public static void main(String[] args)
> >     {
> >             String  temp;
> >             int     startTemp, endTemp, tempC, tempF, temp2;
> >             double  temp1, degreesC, degreesF;
> >             char    degrees;
> >             
> >             temp = JOptionPane.showInputDialog(
> >                     "Enter any temperature (either Celsius or 
> > Farhenheit that you would like to convert");
> >             temp1 = Double.parseDouble(temp);
> >             
> >             degrees = JOptionPane.showInputDialog(
> >                     "Enter C to convert Celsius or F  
> > Fahrenheit.");
> >                     
> >                 if ( (degrees == 'c') || (degrees == 'C') )
> >                 {
> >                             degreesF = temp1;
> >                             degreesC = 5 * (degreesF - 32) /9;
> >                             JOptionPane.showMessageDialog(null,
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
Check out the new Yahoo! Front Page. 
www.yahoo.com 
 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/5cFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    http://groups.yahoo.com/group/beginnersclub/post?act=reply&messageNum=5474
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/beginnersclub/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to