Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: I am having drouble with my java program for calculating the area and circumference of a circle

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I am having drouble with my java program for calculating the area and circumference of a circle

    Here is the code that I wrote out:

    //program that calculates the circumference and area of a circle

    import java.util.Scanner;

    public class circle{

    public static void main(String[] args){

    Scanner input= new Scanner( System.in);


    double r; //declares radius
    double A; //declares area
    double C; //declares circumference

    System.out.print("Entered the radius\n");//prompt
    r=input.nextdouble();//entered the radius

    A=3.14159*r*r;
    C=2*3.14159*r;

    System.out.printf("The value of the circumference is %d\n", C); //displays the result for the area

    System.out.printf("The value of the area is %d\n", A);

    }

    }

    And here is what is displayed in the command prompt when I compile my code:

    circle.java:17: error: cannot find symbol
    r.input.nextdouble();//entered the radius

    symbol: method nextdouble()
    location: variable input of type Scanner
    1 error


    What am I doing wrong


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,073
    My Mood
    Mellow
    Thanks
    184
    Thanked 652 Times in 639 Posts

    Default Re: I am having drouble with my java program for calculating the area and circumference of a circle

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Java has many annoying features (to some). One of them it is that it is case sensitive. nextdouble() is not the same as nextDouble().

Similar Threads

  1. [Easy] Finding area of triangle, rectangle, and circle.
    By GMPoison in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 3rd, 2013, 06:21 PM
  2. Replies: 5
    Last Post: August 10th, 2013, 03:21 PM
  3. Replies: 2
    Last Post: October 16th, 2012, 10:13 PM
  4. Replies: 1
    Last Post: February 10th, 2012, 06:01 AM
  5. java (circle)
    By coder.freak in forum Member Introductions
    Replies: 3
    Last Post: March 26th, 2011, 12:01 PM