Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Here, you will be implementing the MyRectangle2D class, which models a 2D rectangle with x, y coordinates, width and height. It contains: 3 private instance

image text in transcribed

Here, you will be implementing the MyRectangle2D class, which models a 2D rectangle with x, y coordinates, width and height. It contains: 3 private instance variables: topLeft (of type java.awt.Point), width (of type int, default-10) and height (of type int, default=10) A default constructor that constructs a rectangle with default values: Point (0,0), width-10 and height-10, An overloaded constructor that constructs a rectangle with the given point instance. An overloaded constructor that constructs a rectangle with the given width and height values. An overloaded constructor that constructs a rectangle with the given Point instance, width and height values. A tostring() method that returns a string description of the instance in the format "(x, y), width x height" Getter and setter for the instance variables x, y, width and height. Write the MyRectangle2D class in the answer box below. (Remove the "public" keyword when you insert your code.) Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result MyRectangle2D r- new MyRectangle2DO;C0, 0), 10 x 10 System.out.println(r)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Handbook Of Relational Database Design

Authors: Candace C. Fleming, Barbara Von Halle

1st Edition

0201114348, 978-0201114348

More Books

Students also viewed these Databases questions