Results 1 to 3 of 3
  1. #1
    jessie22 is offline Member
    Join Date
    Oct 2011
    Posts
    1
    Rep Power
    0

    Default beinginner needs help with radius and volume problem

    can someone tell me whats wrong with this code, I have only been learning java for a couple of weeks in class: keep getting error message that.Error cannot find symbol, obviously i havent told java something. pleasetry not to blind me with science cos its all a bit new to me, thanks for your help

    /**
    * @(#)volume.java
    *
    *
    * @author
    * @version 1.00 2011/10/10
    */
    import java.util.Scanner;
    public class volume {


    public static void main(String[] args) {
    // TODO code application logic here


    System.out.print("this programme can Calculate the volume of a cylinder of radius 23.5 cm and height 45 cm.");
    double pi = 3.14;
    double radius = 23.5;
    double length=45;

    System.out.print("23.5 ");
    radius = MyInput.readDouble(23.5);
    System.out.print("45 ");
    length = MyInput.readDouble(45);
    System.out.print("Volume = " + (radius*radius*pi*length));
    }
    }

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,361
    Blog Entries
    7
    Rep Power
    20

    Default Re: beinginner needs help with radius and volume problem

    Think as the compiler does: narrow minded and no humour in the vicinity; when it reads 'MyInput' it checks whether or not it 'knows' something about this symbol; is it class? Is it an object of some type, possibly defined by you? No; it doesn't know anything about that symbol so it starts to whine.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    DiamondSoul is offline Member
    Join Date
    Oct 2011
    Posts
    83
    Rep Power
    0

    Default Re: beinginner needs help with radius and volume problem

    At the top of your main method (i.e. just below "public static void main(String[] args){"), put "Scanner MyInput=new Scanner(System.in);". Also, the naming convention in Java is to start variable names with a lowercase letter, so "myInput" would be more appropriate than "MyInput".

Similar Threads

  1. Volume Calculator Problem
    By Sathelan in forum AWT / Swing
    Replies: 1
    Last Post: 04-19-2011, 04:21 AM
  2. Volume of a sphere problem
    By dj_ee3 in forum New To Java
    Replies: 8
    Last Post: 02-14-2011, 02:10 AM
  3. overlap radius... help me..
    By tepong in forum New To Java
    Replies: 1
    Last Post: 08-21-2010, 08:41 PM
  4. coordinates and radius
    By tepong in forum New To Java
    Replies: 1
    Last Post: 08-21-2010, 06:38 PM
  5. java program help. find the radius of a circle
    By megironi in forum New To Java
    Replies: 1
    Last Post: 03-27-2009, 07:09 AM

Posting Permissions

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