Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Fubarable

Thread: Hi, I'm new! I also need help.

  1. #1
    demuro1 is offline Member
    Join Date
    Sep 2012
    Posts
    1
    Rep Power
    0

    Default Hi, I'm new! I also need help.

    Hello,
    I am new to the boards and to Java. I am currently taking a Java class at the JC and am presented with a problem I am unable to solve. I believe my code is correct. I may need to create a directory somewhere and if so I have not done that but I will provide the errors the code and the file paths for current problem. I am coding on a mac. That shouldn't make a difference but thought I'd throw it in there just in case.

    Thanks so much for your help!

    file paths: note that everything resides within the same folder
    Drawing Kit:
    /Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/com/programwithjava/basic/DrawingKit.class

    RectanglDemo.java:
    /Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/RectanglDemo.java


    error message:
    Last login: Sat Sep 8 11:17:58 on ttys000
    demuro1-pc:~ demuro1$ cd '/Users/demuro1/Documents/School/Current Semester/Java:Prog/Homework/Chapter 2/'; javac RectanglDemo.java
    RectanglDemo.java:11: error: cannot find symbol
    Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200);
    ^
    symbol: class Rectangle2DFloat
    location: class RectanglDemo
    RectanglDemo.java:11: error: cannot find symbol
    Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200);
    ^
    symbol: class Rectangle2DFloat
    location: class RectanglDemo
    RectanglDemo.java:12: error: cannot find symbol
    dk.draw(rect1);
    ^
    symbol: variable rect1
    location: class RectanglDemo
    RectanglDemo.java:13: error: cannot find symbol
    BasicStroke = new BasicStroke(22);
    ^
    symbol: variable BasicStroke
    location: class RectanglDemo
    RectanglDemo.java:14: error: cannot find symbol
    dk.setStroke(stroke);
    ^
    symbol: variable stroke
    location: class RectanglDemo
    RectanglDemo.java:15: error: cannot find symbol
    dk.setPaint(Color = blue);
    ^
    symbol: variable Color
    location: class RectanglDemo
    RectanglDemo.java:15: error: cannot find symbol
    dk.setPaint(Color = blue);
    ^
    symbol: variable blue
    location: class RectanglDemo
    RectanglDemo.java:16: error: cannot find symbol
    line1 = new Line2D.Float(285,175,300,155);
    ^
    symbol: variable line1
    location: class RectanglDemo
    RectanglDemo.java:17: error: cannot find symbol
    dk.draw(line1);
    ^
    symbol: variable line1
    location: class RectanglDemo
    9 errors
    demuro1-pc:Chapter 2 demuro1$

    code:
    Java Code:
    import java.awt.*;
    import java.awt.geom.*;
    import com.programwithjava.basic.DrawingKit;
    public class RectanglDemo
    {
     public static void main(String[] args)
     {
     DrawingKit dk = new DrawingKit("Ellipse");
     Rectangle2DFloat rect = new Rectangle2DFloat(50,100,200,200);
     dk.draw(rect1);
     BasicStroke = new BasicStroke(22);
     dk.setStroke(stroke);
     dk.setPaint(Color = blue);
     line1 = new Line2D.Float(285,175,300,155);
     dk.draw(line1);
     }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Hi, I'm new! I also need help.

    Quote Originally Posted by demuro1 View Post
    Hello,
    I am new to the boards and to Java. I am currently taking a Java class at the JC and am presented with a problem I am unable to solve. I believe my code is correct.
    I've been doing this for a bit longer than you, so if there's one thing that I want you to take away from this, and one thing that I've learned the hard way, is to get rid of that assumption: If the compiler tells you you're wrong, you can't hold the belief that you're right. Instead believe the compiler. In fact it is telling you where you're wrong -- the class that you're trying to use, Rectangle2DFloat, doesn't exist. Check the API and use the correct class, one that exists in the API. As for the other problem, BasicStroke, your statement is wrong -- you have declared no variable.

    Another problem, if you're not using an IDE, then it is your responsibility to compile your code often perhaps after adding each new line of code, and not to add any new code until you've fixed your current compilation errors. If you don't do this, your program will be little more than a rat's nest of errors.
    Last edited by Fubarable; 09-12-2012 at 03:35 AM.
    Zyril likes this.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Hi, I'm new! I also need help.

    Please go through the Forum Rules -- especially the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Posting Permissions

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