1.3-Object-Georienteerd-Programmeren

Rectangle

In this assignment, you are going to practice using constructor overloading. We are going to create a Rectangle class with some default properties:

Create this class and make sure that the instance variables are set to these values by default. Now we are going to add some constructors to set different properties when creating:

Try to avoid code duplication by having constructors call each other.

Finally, add the method draw() that can draw the rectangle in the SaxionApp. Test your application by taking the code in the Application class out of comments. Create some rectangles of your own. The result of the sample code should look like this:

Result