So for my assignment it needs to look like this: Assignment
The problem I am facing with this is the setIndent isn't setting the indent but when I mainly change int indent = 20; it will add the indent to the boxes. Also I am confused as to why Rectangle@6bdf28bb is appearing in my code.
Here is my code for the assignment.
Client
// Use this client to help test your Rectangle class for Lab13
// Download it into the same folder as your Rectangle.java file.
// Add other tests if you want to.
public class RectangleClient {
  public static void main( String[] args ) {
     Rectangle box1 = new Rectangle( 4, 5 );
     box1.setIndent(-1);
     System.out.println( box1 );
     Rectangle box2 = new Rectangle( 6, 12, '+', 'X' );
     box2.setIndent( 5 );
     System.out.println( box2 );
     Rectangle box3 = new Rectangle( 11, 20, '$', 'o' );
     box3.setIndent( 20 );
     System.out.println( box3 );
  }
}
Class
//Using rectangle class to test
public class Rectangle {
    public double length;
    public double width;
    public char fill = ' ';
    public char pen = '*';
    public int indent;
    //Set variables
    public void setLength(double len){
        if (len <= 0){
            throw new IllegalArgumentException("Invalid length for Rectangle object");
        }
        else{
            length = len;
        }
    }
    public void setWidth(double wid){
        if (wid <=0){
            throw new IllegalArgumentException("Invalid width for Rectangle object");
        }
        else{
            width = wid;
        }
    }
    public void setPen(char c){
        pen = c;
    }
    public void setFill(char c){
        fill = c;
    }
    public void setIndent(int n){
        if (n < 0){
            indent = 0;
        }
        else {
            indent = n;
        }
    }
    //Get variables
    public double getLength(){
        return length;
    }
    public double getWidth(){
        return width;
    }
    public double getIndent(){
        return indent;
    }
    //Main method
    public Rectangle (){
        int count = 0;
        String indents = "";
        String topBottom = "";
        String middle = "";
        String line = "";
        //Creates the indent string
        while (count<indent){
            indents = indents + " ";
            count++;
        }
        //Top boarder and bottom one
        count = 0;
        while (count<width){
            topBottom += pen;
            count++;
        }
        //Fill inside square
        width = width - 2;
        count = 0;
        while (count<width){
            middle += fill;
            count++;
        }
        //Prints square
        line = pen + middle + pen;
        count = 0;
        while (count<length){
            if (count == 0 || count == length - 1){
                System.out.println(indents + topBottom);
                count++;
            }
            else{
                System.out.println(indents + line);
                count++;
            }
        }
    }
    // using default or set fill and boarder      
    public Rectangle (double l, double w){
        int count = 0;
        String indents = "";
        String topBottom = "";
        String middle = "";
        String line = "";
        //Creates the indent string
        while (count<indent){
            indents = indents + " ";
            count++;
        }
        //Top boarder and bottom one
        count = 0;
        while (count<w){
            topBottom += pen;
            count++;
        }
        //Fill inside square
        w = w - 2;
        count = 0;
        while (count<w){
            middle += fill;
            count++;
        }
        //Prints square
        line = pen + middle + pen;
        count = 0;
        while (count<l){
            if (count == 0 || count == l - 1){
                System.out.println(indents + topBottom);
                count++;
            }
            else{
                System.out.println(indents + line);
                count++;
            }
        }
    }
    //To set values without using .setWidth etc  
    public Rectangle (double l, double w, char p, char f){
        int count = 0;
        String indents = "";
        String topBottom = "";
        String middle = "";
        String line = "";
        //Creates the indent string
        while (count<indent){
            indents += " ";
            count++;
        }
        //Top boarder and bottom one
        count = 0;
        while (count<w){
            topBottom += p;
            count++;
        }
        //Fill inside square
        w = w - 2;
        count = 0;
        while (count<w){
            middle += f;
            count++;
        }
        //Prints square
        line = indents + p + middle + p;
        topBottom = indents + topBottom;
        count = 0;
        while (count<l){
            if (count == 0 || count == l - 1){
                System.out.println(topBottom);
                count++;
            }
            else{
                System.out.println(line);
                count++;
            }
        }
    }
}
The error I'm getting is that it is not adding the indents and the random Rectangle@2ff4f00f

 
     
    