Question
i need a plot class with this javadoc and with this java file Data Element class Plot.java The class Plot will contain: Instance variables to
i need a plot class with this javadoc and
with this java file
Data Element class Plot.java
The class Plot will contain:
Instance variables to represent the x and y coordinates of the upper left corner of the location, and depth and width to represent the vertical and horizontal extents of the plot.
A toString method to represent a Plot object
Constructors (a no-arg constructor, a copy constructor and a parameterized constructor)
A method named overlaps that takes a Plot instance and determines if it is overlapped by the current plot.
A method named encompasses that takes a Plot instance and determines if the current plot contains it. Note that the determination should be inclusive, in other words, if an edge lies on the edge of the current plot, this is acceptable.
Data Structure An Array of Property objects to hold the properties that the management company handles.
https://bb-montgomerycollege.blackboard.com/bbcswebdav/pid-3964478-dt-content-rid-28959944_1/courses/21923.201920/Plot%282%29.html
import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; public class PlotTest { private Plot plot1, plot3, plot4, plot5, plot6, plot9, plot10, plot11; @Before public void setUp() throws Exception { plot1 = new Plot(2,2,6,6); plot3 = new Plot(1,1,3,2); plot4 = new Plot(6,1,4,2); plot5 = new Plot(3,4,4,3); plot6 = new Plot(6,5,3,1); plot9 = new Plot(1,4,2,1); plot10 = new Plot(9,2,2,2); plot11 = new Plot(2,2,2,1); } @After public void tearDown() throws Exception { plot1=null; } @Test public void testOverlaps1() { assertTrue(plot1.overlaps(plot5)); //plot5 is entirely inside plot1 assertTrue(plot5.overlaps(plot1)); } @Test public void testOverlaps2() { assertTrue(plot1.overlaps(plot3)); //plot3 overlaps the lower left corner of plot1 assertTrue(plot3.overlaps(plot1)); assertTrue(plot1.overlaps(plot4)); //plot4 overlaps the lower right corner of plot1 assertTrue(plot4.overlaps(plot1)); } @Test public void testOverlaps4() { assertTrue(plot1.overlaps(plot9)); //plot9 overlaps the left side of plot1 assertTrue(plot9.overlaps(plot1)); assertTrue(plot1.overlaps(plot6)); //plot6 overlaps the right side of plot1 assertTrue(plot6.overlaps(plot1)); } @Test public void testOverlaps6() { assertFalse(plot3.overlaps(plot4)); //plot3 does not overlap plot4 assertFalse(plot4.overlaps(plot3)); assertFalse(plot1.overlaps(plot10)); //plot1 does not overlap plot10 assertFalse(plot10.overlaps(plot1)); } @Test public void testEncompasses1() { assertTrue(plot1.encompasses(plot5)); //plot5 is contained in plot1 assertFalse(plot5.encompasses(plot1)); assertTrue(plot1.encompasses(plot11)); //plot11 is contained in plot1 assertFalse(plot11.encompasses(plot1)); assertFalse(plot3.encompasses(plot1)); //plot3 does not encompass plot1 assertFalse(plot1.encompasses(plot3)); //plot1 does not encompass plot3 } }
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