Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8489329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:47:58+00:00 2026-06-10T21:47:58+00:00

I’m getting the error below and these are my classes. Shape class: public abstract

  • 0

I’m getting the error below and these are my classes.

Shape class:

public abstract class Shape implements Triangle{

 protected static final double DEFAULT_SIZE = (double) 1.0;
 protected static final String DEFAULT_NAME = "Unknown";
 private String shapeName;

 public Shape(){
    this.shapeName = DEFAULT_NAME;
 }

 public Shape(String name) {
    setShapeName(name);

 }

 protected void setShapeName(String name) {
 if( name.trim().length() == 0 )
     shapeName = DEFAULT_NAME;
 else
     shapeName = new String ( name );

 }

 public String getShapeName() {
    //name
 return shapeName;

 }



public abstract double getSurfaceArea();

public abstract double getPerimeter();


public String toString{
    return String.format("%s %s\nshape name: %s",getShapeName());
}
}

rectangle class:

public class Rectangle extends Shape implements Triangle {



private double length;
private double heigth;

public Rectangle() {
    super("Rectangle");
    setLength( super.DEFAULT_SIZE );
    setHeight( Shape.DEFAULT_SIZE );

}

public Rectangle(double theLength, double theHeight ){
    super("Rectangle");
    if ( theLength < 0 )
        setLength( Shape.DEFAULT_SIZE );
    else setLength( theLength );

    if ( theHeight < 0)
        setHeight( Shape.DEFAULT_SIZE );
    else setHeight( theHeight );
}



public double getSurfaceArea() {
    return this.length * this.heigth;
}

public double getPeremeter() {
    return 2 * this.length + 2 * this.length;

}

public double getLength(){
    return this.length;
}

public double getHeight(){
    return  this.heigth;
}

public void setLength( double theLength ){
    if ( theLength <= 0 )
        return;
    this.length = theLength;
}

public void setHeight( double theHeight ){
    if (theHeight <= 0 )
        return;
    this.heigth = theHeight;

}

public String toString(){
    return String.format("%s: \n%s: %s (%s) \n%s: %d \n%s: $%,.2f",
                      "Rect Surface Area ", "Rect Peremeter", getSurfaceArea(), getPeremeter());
}

 public double getSizeAmount(){

}

   }

circle class:

public class Circle extends Shape {
private double radius;

public Circle( double theRadius ){
    super( "Circle" );
    if ( theRadius <= 0.0 )
        setRadius( Shape.DEFAULT_SIZE );
    else
        setRadius( theRadius );
}

public Circle(String string, String string2, String string3, String string4) {
    // TODO Auto-generated constructor stub
}

public double getSurfaceArea(){

    return this.radius * this.radius * Math.PI;
}

public double getPeremeter(){
    ;
    return 2 * this.radius + Math.PI;
}

public double getRadius(){
    return this.radius;

}

public void setRadius( double theRadius ) {
    if( theRadius <= 0 )
        return;
    this.radius = theRadius;
}

@Override
public double getPerimeter() {
    // TODO Auto-generated method stub
    return 0;

     public double getSizeAmount(){

     }

     public String toString(){
         return String.format("%s: \n%s: %s (%s) \n%s: %d \n%s: $%,.2f",
                  "Circle Surface Area ", "Circle Peremeter", getSurfaceArea(), getPeremeter());
     }
}
   }

triangle class:

//triangle interface decleration
public interface Triangle {



double getSizeAmount(); //calculate sizes of triangle; no implementation

    }//end interface triangle

main class:

    import javax.swing.JOptionPane;




    public class ShapeApp {

//public static void main(String args[])
public static void main(String[] args) {

    Triangle triangleObjects[] = new Triangle[ 4 ];

    triangleObjects[ 0 ] = new Rectangle("3.5", "4.6","42");
    triangleObjects[ 1 ] = new Rectangle("3", "2","34");
    triangleObjects[ 2 ] = new Circle("Circle", "Rectangle","0808","0808");
    triangleObjects[ 3 ] = new Circle("Circle","Rectangle","2334","2423");

    System.out.println( "List of all Shapes:\n" );

    for( Triangle currentTriangle : triangleObjects ){

        System.out.printf("%s \n%s: $%,.2f\n\n",
                currentTriangle.toString(),
                "ovo testiramo", currentTriangle.getSizeAmount());

    }


}

}

This is the error I’m getting:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
The constructor Rectangle(String, String, String) is undefined
The constructor Rectangle(String, String, String) is undefined

at ShapeApp.main(ShapeApp.java:14)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T21:47:59+00:00Added an answer on June 10, 2026 at 9:47 pm

    Error message is very clear:

    The constructor Rectangle(String, String, String) is undefined
    
    at ShapeApp.main(ShapeApp.java:14)
    

    You are creating Rectangle object with 3 parameters.

     new Rectangle("3.5", "4.6","42");
    

    But your Rectangle class has only two constructors

    1) Consturctor with Zero args 2) Constructor with 2 args

    public Rectangle() {
      ......
    
    }
    
    public Rectangle(double theLength, double theHeight )
    { ....
    }
    

    You need to add constructor with 3 arguments in Rectangle class (or) Change your object creation to two args constructor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.