Results 1 to 4 of 4
Like Tree2Likes
  • 1 Post By pbrockway2
  • 1 Post By SerbianSergeant

Thread: New to java stop need help stop

  1. #1
    Skrap09 is offline Member
    Join Date
    Sep 2011
    Location
    Iowa
    Posts
    2
    Rep Power
    0

    Default New to java stop need help stop

    This is probably a very easy fix but then again, I'm very new to programming. Please send help.

    import java.util.Scanner;

    public class FahrenheitToCelsius {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);

    System.out.print("Enter a degree in Fahrenheit: ");
    double fahrenheit = input.nextDouble();

    //Convert Fahrenheit to Celsius
    double celcius = (5.0 / 9) * (fahrenheit - 32);
    System.out.println("Fahrenheit " + fahrenheit + " is " +
    celsius + " in Celsius");
    }
    }

    FahrenheitToCelsius.java:13: error: cannot find symbol
    celsius + " in Celsius");
    ^
    symbol: variable celsius
    location: class FahrenheitToCelsius
    1 error

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default Re: New to java stop need help stop

    You get a "cannot find symbol" for a variable if you have not declared it, or if you have made a spelling mistake.
    Skrap09 likes this.

  3. #3
    Join Date
    Jul 2011
    Posts
    30
    Rep Power
    0

    Default Re: New to java stop need help stop

    Quote Originally Posted by Skrap09 View Post
    This is probably a very easy fix but then again, I'm very new to programming. Please send help.

    import java.util.Scanner;

    public class FahrenheitToCelsius {
    public static void main(String[] args) {
    Scanner input = new Scanner(System.in);

    System.out.print("Enter a degree in Fahrenheit: ");
    double fahrenheit = input.nextDouble();

    //Convert Fahrenheit to Celsius
    double celcius = (5.0 / 9) * (fahrenheit - 32);
    System.out.println("Fahrenheit " + fahrenheit + " is " +
    celsius + " in Celsius");
    }
    }

    FahrenheitToCelsius.java:13: error: cannot find symbol
    celsius + " in Celsius");
    ^
    symbol: variable celsius
    location: class FahrenheitToCelsius
    1 error
    When you declared the double "celcius" you spelled it with a "c" in the middle. However when you print this to the console you have spelled it "celsius" with an "s" in the middle. Change the double declaration from "celcius" into "celsius" and it should then work :)

    Regards Serb.
    Skrap09 likes this.

  4. #4
    Skrap09 is offline Member
    Join Date
    Sep 2011
    Location
    Iowa
    Posts
    2
    Rep Power
    0

    Default Re: New to java stop need help stop

    Lol good eye, I looked up the error message but i guess I overlooked it by a smidgen. Thanks!

Similar Threads

  1. Stop Java Logger writing the calling Class?
    By mattlindsay in forum New To Java
    Replies: 2
    Last Post: 04-07-2011, 12:27 AM
  2. how to start and stop other java applicaton
    By Jhovarie in forum Threads and Synchronization
    Replies: 1
    Last Post: 02-23-2011, 09:51 AM
  3. Replies: 25
    Last Post: 11-04-2010, 05:26 PM
  4. Use stop button to stop moving (stop timers) on JPanel
    By mneskovic in forum New To Java
    Replies: 3
    Last Post: 07-23-2010, 01:50 PM
  5. Replies: 0
    Last Post: 01-24-2008, 08:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •