Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python program geometry tool Description: Suppose you are a software engineer at Shepards, a software company focusing on developing simulation software and scientific computing tools.
python program geometry tool
Description: Suppose you are a software engineer at Shepards, a software company focusing on
developing simulation software and scientific computing tools. You are assigned to create a class
that can compute the attributes of a rectangle and the relationship between a rectangle and
another geometry object.
Below are the detailed requirements of the class that you need to develop.
Goals: Define the MyRectangleD class that contains:
Two double data fields named x and y specify the center of the rectangle with getter and
setter methods. Assume that the rectangle sides are parallel to x or yaxes.
The data fields width and height with getter and setter methods.
A constructor that creates a default rectangle with for x y and for both width
and height.
A method getarea that returns the area of the rectangle.
A method getperimeter that returns the perimeter of the rectangle.
A method containpointx y that returns true if the specified point x y is inside
this rectangle see Figure a
A method containsrectangled that returns true if the specified rectangle is inside this
rectangle see Figure b
A method overlapsrectangled that returns true if the specified rectangle overlaps
with this rectangle see Figure c
Task I: Draw the UML diagram for the class and then implement the class.
Task II: Write a test program that
a creates a MyRectangleD object r with
b displays the area and perimeter of r
c displays the result of rcontainpoint
d displays the result of rcontainsMyRectangleD
e and roverlapsMyRectangleD
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started