shape problems

  • (2 Pages)
  • +
  • 1
  • 2

27 Replies - 1137 Views - Last Post: 24 August 2019 - 09:27 AM Rate Topic: -----

#1 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

shape problems

Posted 23 August 2019 - 08:24 AM

hey guys i have a one question...i have a program that sould work but for some reason it doesnt error is cannot find symbol:method rectangle,cube...does anyone know why doesnt work??...tnx for hečp guys

rectangle class:
package gorund.pkg43.shapes;


public class rectangle {
    protected int lenghtt;
    protected int width;
    public rectangle()
    {
        lenghtt=0;
        width=0;
    }
    public rectangle(int l,int w)
    {
        lenghtt=l;
        width=w;
    }
    public int area()
    {
        return lenghtt*width;
    }
    
    
}




cube class
package gorund.pkg43.shapes;


public class cube {
    protected int lenghtt;
    protected int width;
    private int height;
    
    public cube()
    {
        lenghtt=0;
        width=0;
        height=0;
    }
    public cube(int l,int w,int h)
    {
        lenghtt=l;
        width=w;
        height=h;
    }
    
    public int AREA()
    {
        return lenghtt*width*height;
    }
    
}




size class
package gorund.pkg43.shapes;


public class Size {
    
    public static int Size(Object z)
    {
        if(z instanceof rectangle )
            return((rectangle)z).area();
        else if(z instanceof cube)
        return((cube)z).AREA();
        
        else
            return -1;
        
    }
    
}



main program
package gorund.pkg43.shapes;


public class Gorund43Shapes {

   
    public static void main(String[] args) {
        
        rectangle r=new rectangle(3,5);
        cube c=new cube(5,6,7);
        Size s=new Size();
        
        System.out.println("rectanngle has size "+s(r));
        System.out.println("cube has size "+s(c));
        
    }

    
    
}



This post has been edited by modi123_1: 23 August 2019 - 04:33 PM
Reason for edit:: fixed botched code tags


Is This A Good Question/Topic? 0
  • +

Replies To: shape problems

#2 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3639
  • View blog
  • Posts: 16,727
  • Joined: 20-September 08

Re: shape problems

Posted 23 August 2019 - 08:28 AM

Please paste full error
http://technojeeves....java1/17-errors
Was This Post Helpful? 0
  • +
  • -

#3 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 23 August 2019 - 08:55 AM

cannot find symbol
symbol methods (rectangle or cube)
location class Gorund43Shapes
Was This Post Helpful? 0
  • +
  • -

#4 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3639
  • View blog
  • Posts: 16,727
  • Joined: 20-September 08

Re: shape problems

Posted 23 August 2019 - 10:16 AM

I don't believe you pasted that
Was This Post Helpful? 0
  • +
  • -

#5 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 23 August 2019 - 12:32 PM

i didint paste..i write it...so what are the difrence paste/write?? i just nedd help why doesent work
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15228
  • View blog
  • Posts: 60,973
  • Joined: 12-June 08

Re: shape problems

Posted 23 August 2019 - 12:43 PM

Copy/pasting the full error removes any ambiguity on the exact message, and often indicates specific lines and/or error code values that help folk to help you.
Was This Post Helpful? 0
  • +
  • -

#7 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 23 August 2019 - 02:08 PM

how to copy full error in netbeans??
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15228
  • View blog
  • Posts: 60,973
  • Joined: 12-June 08

Re: shape problems

Posted 23 August 2019 - 03:37 PM

I would presume there is an error or console the errors are being printed to. Best bet it to start there.
Was This Post Helpful? 0
  • +
  • -

#9 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 23 August 2019 - 04:21 PM

i dont know how to copy in netbenas but it doensent even matter i written al whar error is :
cannot find symbol
symbol methods (rectangle or cube)
location class Gorund43Shapes

so why my main program doesent recognize size class??
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15228
  • View blog
  • Posts: 60,973
  • Joined: 12-June 08

Re: shape problems

Posted 23 August 2019 - 04:34 PM

I would think it does matter if another member was asking for that information and I gave a general reason why it's important, but suit yourself.

Good luck. Hopefully folk can help decipher your issue.
Was This Post Helpful? 0
  • +
  • -

#11 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 23 August 2019 - 04:50 PM

i dont know if this would be helpfull but this is only error that i can copy...run:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any>
at gorund.pkg43.shapes.Gorund43Shapes.main(Gorund43Shapes.java:14)
C:\Users\Dejan\AppData\Local\NetBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)
Was This Post Helpful? 0
  • +
  • -

#12 NormR   User is online

  • D.I.C Lover
  • member icon

Reputation: 781
  • View blog
  • Posts: 5,903
  • Joined: 25-December 13

Re: shape problems

Posted 23 August 2019 - 06:07 PM

Here is an example of an error message from the javac program:
TestCode25.java:1123: error: cannot find symbol
      int x = y;
              ^
  symbol:   variable y
  location: class TestCode25
1 error


The first line gives the source filename: TestCode25.java
and the line number where the error is: 1123
and what the error was: cannot find symbol
Then the source line is shown
Under the source line there is a ^ that points to where the error was
Then on the next line the error message says the symbol is the variable y
Was This Post Helpful? 0
  • +
  • -

#13 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 24 August 2019 - 04:20 AM


package gorund.pkg43.shapes;


public class Gorund43Shapes {

   
    public static void main(String[] args) {
        
        rectangle r=new rectangle(3,5);
        cube c=new cube(5,6,7);
        Size s=new Size();
        
        System.out.println("rectanngle has size "+s(r));
        System.out.println("cube has size "+s(c));
        
    }

    
    
}







source file namne:Gorund43Shapes.java
line:13 ad 14
error...cannot find symbol
location:Gorund43Shapes

This post has been edited by kretze: 24 August 2019 - 04:22 AM

Was This Post Helpful? 0
  • +
  • -

#14 NormR   User is online

  • D.I.C Lover
  • member icon

Reputation: 781
  • View blog
  • Posts: 5,903
  • Joined: 25-December 13

Re: shape problems

Posted 24 August 2019 - 04:36 AM

The error message does not contain the name of the symbol that can not be found.
Can you copy the FULL text of the error message and paste it here?
Was This Post Helpful? 0
  • +
  • -

#15 kretze   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 101
  • Joined: 22-October 18

Re: shape problems

Posted 24 August 2019 - 05:09 AM

error message

This post has been edited by kretze: 24 August 2019 - 05:13 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2