Java program with while loops and if else statements ( I'm confused )

I'm getting these errors and I'm really confused now...

tempconversion.java:18: error: incomparable types: Scanner and int
   if( F2C == 0){
           ^
tempconversion.java:20: error: cannot find symbol
   while (stdin.hasnext () )   {
               ^
  symbol:   method hasnext()
  location: variable stdin of type Scanner
tempconversion.java:23: error: cannot find symbol
      tC= ((stdin * 9.0)/ 5.0)+ 32.0 ; 
      ^
  symbol:   variable tC
  location: class tempconversion
tempconversion.java:23: error: bad operand types for binary operator '*'
      tC= ((stdin * 9.0)/ 5.0)+ 32.0 ; 
                  ^
  first type:  Scanner
  second type: double
tempconversion.java:24: error: cannot find symbol
      System.out.println( " Input : " + (stdin.nextDouble));
                                              ^
  symbol:   variable nextDouble
  location: variable stdin of type Scanner
tempconversion.java:24: error: illegal start of type
      System.out.println( " Input : " + (stdin.nextDouble));
                                        ^
tempconversion.java:25: error: cannot find symbol
      System.out.println ( "Converted : " + ( tC )) ;
                                              ^
  symbol:   variable tC
  location: class tempconversion
tempconversion.java:25: error: illegal start of type
      System.out.println ( "Converted : " + ( tC )) ;
                                            ^
tempconversion.java:30: error: cannot find symbol
   while (stdin.hasnext () )   {
               ^
  symbol:   method hasnext()
  location: variable stdin of type Scanner
tempconversion.java:33: error: cannot find symbol
      tF= ((stdin - 32.0) * 5.0) / 9.0 ; 
      ^
  symbol:   variable tF
  location: class tempconversion
tempconversion.java:33: error: bad operand types for binary operator '-'
      tF= ((stdin - 32.0) * 5.0) / 9.0 ; 
                  ^
  first type:  Scanner
  second type: double
tempconversion.java:34: error: cannot find symbol
      System.out.println( " Input : " + (stdin.nextDouble));
                                              ^
  symbol:   variable nextDouble
  location: variable stdin of type Scanner
tempconversion.java:34: error: illegal start of type
      System.out.println( " Input : " + (stdin.nextDouble));
                                        ^
tempconversion.java:35: error: cannot find symbol
      System.out.println ( "Converted : " + ( tF )); }
                                              ^
  symbol:   variable tF
  location: class tempconversion
tempconversion.java:35: error: illegal start of type
      System.out.println ( "Converted : " + ( tF )); }
                                            ^
15 errors

Open in new window


My program is below:

//converts temperatures from centigrade to farenheit and vice versa using manuel input from the user

import java.util.Scanner;

public class tempconversion
{
   public static void main (String[] args)
   {
   Scanner stdin = new Scanner (System.in) ;
   Scanner F2C = new Scanner (System.in) ;
          
   System.out.println ( "If you are converting F ==> C press 0 " ) ;
   System.out.println ( "If you are converting C ==> F press 1 " ) ;
   F2C.nextDouble() ; 
      
   if( F2C == 0){
      
   while (stdin.hasnext () )   {
      System.out.println ( "Enter next input : " );
      stdin.nextDouble () ;
      tC= ((stdin * 9.0)/ 5.0)+ 32.0 ; 
      System.out.println( " Input : " + (stdin.nextDouble));
      System.out.println ( "Converted : " + ( tC )) ;
   
   }
   } else {{
      
   while (stdin.hasnext () )   {
      System.out.println ( "Enter next input : " );
      stdin.nextDouble () ;
      tF= ((stdin - 32.0) * 5.0) / 9.0 ; 
      System.out.println( " Input : " + (stdin.nextDouble));
      System.out.println ( "Converted : " + ( tF )); }
   
   }

   
   } 
   System.out.println ( "Good Bye " ) ; 
      
   }

Open in new window

aminkeithAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
This questions look like they are academic related (ie, homework, assignments, etc). While you have done the right thing in making an attempt yourself and then asking questions here, you should still state in the initial question that it is academic related so that the experts that post can do so appropriately. I will proceed assuming that this is the case.

Ok, so general comments on what you are doing... Scanner is a class to help get input in from the console/terminal. You only need 1 of these to be created for the System.in inputstream, so I recommend removing one of them.

The other main point is that Scanner's  .nextDouble() method actually returns the input number, so you need to actually store the return value in a variable, ie. something like   double inputValue = stdin.nextDouble();    and then you can use inputValue in your calculations, output display, etc.



See if you can use the above to help resolve your issues, and if you still have errors, please post them here.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.