Java代写 | CSDS 293 Software Craftsmanship Programming Assignment 4


Special Grading Guidelines

Starting with this assignment, an automatic C (or less) is triggered
• Any routine with complexity greater than 4, or by
• Any piece of code that is essentially repeated.
However, a submission that avoids these problems does not
necessarily qualify for high quality craftsmanship.


First, make all the changes discussed in your discussion section.

Additionally, you should refactor your code to make sure that it
adopts the principles covered in the reading assignments.

The main topic of this assignment is to create a rectilinear region,
which is an area of the map delimited by multiple rectangles, and to
determine whether the rectangles in the region are overlapping or

Two-Dimensional Maps

To support rectangles, add the following methods to

• A package-private constructor

Collection<BigDecimal> xCoord,
Collection<BigDecimal> yCoord)
that enters a new empty hash map in all the points of xCoord
× yCoord. For example, if xCoord is [1, 2] and yCoord is the
collection [3, 4, 5], then the new map will have empty sets in
(1, 3), (1, 4), (1, 5), (2, 3), (2, 4), and (2, 5).

• public final void addEverywhere(T value) that adds

the given value everywhere in the map.

Rectilinear Regions

Create a public final class RectilinearRegion with a
private final Set<Rectangle> rectangles and its getter. The
constructor private RectilinearRegion(Set<Rectangle>
rectangles) sets the private variable to a copy of the argument.

The main algorithm in this assignment creates a new map with only
the points in the rectilinear region.

Algorithm rectangle-map

Return: a two-dimensional map of rectangles, in which a rectangle
appears in all the points within the rectangle (left and bottom
edges inclusive; right and top edges exclusive).
xCoord ← set of all left and right horizontal coordinates in the
yCoord ← set of all bottom and top vertical coordinates in the
grid ← new two-dimensional map with coordinates at xCoord × yCoord
and empty contents
insert each rectangle everywhere in its grid slice
return grid

The public boolean isOverlapping() returns whether the
rectilinear region contains overlapping rectangles. The method
public static final RectilinearRegion(Set<Rectangle>
rectangles) returns a new rectilinear region if the rectangle set is
not null and not overlapping.

Interest Points

The method

public final long count(
RectilinearRegion region,
M marker)
returns the number of interest points within the given non-
overlapping region with the given marker.

General Considerations

These classes may contain as many auxiliary private and package-
private methods as you see fit, and additional package-private
helper classes may be defined. However, any modification or
addition to public classes and methods must be approved by the
instructors at the discussion board.

You should write JUnit tests to make sure that your primary
methods work as intended. However, we will revisit testing later on
in the course, so extensive testing is not yet recommended. If you
have never used JUnit, the JUnit module on canvas lists resources to
get you started. Similarly, your code should have a reasonable
number of comments, but documentation is going to be the topic of
a future assignment. As a general guideline at this stage of the
course, comments and tests should be like those accepted in CSDS


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail:  微信:itcsdx