[SOLVED] CS221 Assignment4-Network Log Utility

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment_4-akaieo.zip (466.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Β 

Network Log Utility.

In this assignment we implement a Java class hierarchy which represents various two‐dimensional and three‐dimensional shapes. The hierarchy extends classes/interfaces from Java’s API and defines new abstract and concrete classes. As a start, I am providing the class’ stubs without any implementation. You may choose to write your implementation without relying on the provided stubs; however, please adhere to the naming conventions shown in the UML diagram. A test class is provided for this assignment. You will be graded on the efficiency of your code; reuse parent implementation whenever possible. Please submit a ZIP file containing your 6 classes.

Preamble

From Java’s API we will utilize a number of classes including:

  1. π‘‡π‘Ÿπ‘’π‘’π‘†π‘’π‘‘, a class for maintaining a collection of objects in a sorted fashion. Using π‘‡π‘Ÿπ‘’π‘’π‘†π‘’π‘‘ is similar to using an π΄π‘Ÿπ‘Ÿπ‘Žπ‘¦πΏπ‘–π‘ π‘‘. The π‘‡π‘Ÿπ‘’π‘’π‘†π‘’π‘‘ works best with objects that implement the πΆπ‘œπ‘šπ‘π‘Žπ‘Ÿπ‘Žπ‘π‘™π‘’
  2. πΆπ‘œπ‘šπ‘π‘Žπ‘Ÿπ‘Žπ‘π‘™π‘’, a generic type interface (i.e. template); classes that implement this interface are forced to implement the method π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ. The π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ defines how two objects of the same type are compared. The basic implementation of the π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ is to, first, decide on how to compare two objects and, second, return either: ΓΌ A 0 if two objects are deemed equivalent.
    • A negative number if the left object is smaller than the right object
    • A positive number if the left object is greater than the right object

Here is an example which compares two class objects based on the π‘“π‘–π‘Ÿπ‘ π‘‘ and π‘ π‘’π‘π‘œπ‘›π‘‘ fields respectively. Two objects of type π‘€π‘¦πΆπ‘™π‘Žπ‘ π‘  are deemed equal if their π‘“π‘–π‘Ÿπ‘ π‘‘ and π‘ π‘’π‘π‘œπ‘›π‘‘ values are the same. If the π‘“π‘–π‘Ÿπ‘ π‘‘ fields are not equal, the result of π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ are based on comparing the π‘“π‘–π‘Ÿπ‘ π‘‘ fields only. However, if the π‘“π‘–π‘Ÿπ‘ π‘‘ fields are equal, the result of π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ is based on the comparison between the π‘ π‘’π‘π‘œπ‘›π‘‘ fields.

// π‘›π‘œπ‘‘π‘’ π‘‘β„Žπ‘’ π‘π‘™π‘Žπ‘ π‘  π‘›π‘Žπ‘šπ‘’ 𝑏𝑒𝑑𝑀𝑒𝑒𝑛 π‘Žπ‘›π‘”π‘™π‘’ π‘π‘Ÿπ‘Žπ‘π‘˜π‘’π‘‘π‘ 

𝑝𝑒𝑏𝑙𝑖𝑐 π‘π‘™π‘Žπ‘ π‘  π‘€π‘¦πΆπ‘™π‘Žπ‘ π‘  π‘–π‘šπ‘π‘™π‘’π‘šπ‘’π‘›π‘‘π‘  πΆπ‘œπ‘šπ‘π‘Žπ‘Ÿπ‘Žπ‘π‘™π‘’Β Β Β Β Β  π‘€π‘¦πΆπ‘™π‘Žπ‘ π‘ 

𝑖𝑛𝑑 π‘“π‘–π‘Ÿπ‘ π‘‘;

π‘†π‘‘π‘Ÿπ‘–π‘›π‘” π‘ π‘’π‘π‘œπ‘›π‘‘;

@π‘‚π‘£π‘’π‘Ÿπ‘Ÿπ‘–π‘‘π‘’

𝑝𝑒𝑏𝑙𝑖𝑐 𝑖𝑛𝑑 π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ π‘€π‘¦πΆπ‘™π‘Žπ‘ π‘  π‘œπ‘‘β„Žπ‘’π‘Ÿ

Β 

𝑖𝑛𝑑 π‘Ÿπ‘’π‘ π‘’π‘™π‘‘ Β Β Β Β Β Β Β  Β πΌπ‘›π‘‘π‘’π‘”π‘’π‘Ÿ. π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’ π‘“π‘–π‘Ÿπ‘ π‘‘, π‘œπ‘‘β„Žπ‘’π‘Ÿ. π‘“π‘–π‘Ÿπ‘ π‘‘ ;

Β 

// 𝑖𝑓 π‘‘β„Žπ‘’ π‘“π‘–π‘Ÿπ‘ π‘‘ 𝑓𝑖𝑒𝑙𝑑𝑠 π‘šπ‘Žπ‘‘π‘β„Ž, π‘Ÿπ‘’π‘ π‘’π‘™π‘‘π‘  π‘Žπ‘Ÿπ‘’ π‘π‘Žπ‘ π‘’π‘‘ π‘œπ‘› π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘–π‘›π‘” π‘‘β„Žπ‘’ π‘ π‘’π‘π‘œπ‘›π‘‘ 𝑓𝑖𝑒𝑙𝑑𝑠

𝑖𝑓 π‘Ÿπ‘’π‘ π‘’π‘™π‘‘ Β Β Β Β Β Β Β Β Β  Β 0

// π‘Ÿπ‘’π‘ π‘’π‘™π‘‘ 𝑖𝑠 π‘π‘Žπ‘ π‘’π‘‘ π‘œπ‘› π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘–π‘›π‘” π‘‘β„Žπ‘’ π‘ π‘’π‘π‘œπ‘›π‘‘ 𝑓𝑖𝑒𝑙𝑑𝑠

π‘Ÿπ‘’π‘‘π‘’π‘Ÿπ‘› π‘ π‘’π‘π‘œπ‘›π‘‘. π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ π‘œπ‘‘β„Žπ‘’π‘Ÿ. π‘ π‘’π‘π‘œπ‘›π‘‘ ;

Β 

Β 

// β„Žπ‘’π‘Ÿπ‘’ π‘€β„Žπ‘’π‘› π‘‘β„Žπ‘’ π‘“π‘–π‘Ÿπ‘ π‘‘ 𝑓𝑖𝑒𝑙𝑑𝑠 π‘‘π‘œ π‘›π‘œπ‘‘ π‘šπ‘Žπ‘‘π‘β„Ž

π‘Ÿπ‘’π‘‘π‘’π‘Ÿπ‘› π‘Ÿπ‘’π‘ π‘’π‘™π‘‘;

Β 

Β 

Class’ Description:

The assignment consists of 6 Java classes, 3 abstract and 3 non‐abstract classes and 1 test class. Class stubs are provided for an easier start.

  1. 𝑺𝒉𝒂𝒑𝒆:
  • An abstract class which implements Java’s πΆπ‘œπ‘šπ‘π‘Žπ‘Ÿπ‘Žπ‘π‘™π‘’ Interface
  • Contains two abstract methods, π‘Žπ‘Ÿπ‘’π‘Ž and π‘π‘’π‘Ÿπ‘–π‘šπ‘’π‘‘π‘’π‘Ÿ.
  • π‘‘π‘œπ‘†π‘‘π‘Ÿπ‘–π‘›π‘”: returns a space‐delimited string of its fields:

β‰ͺ π‘£π‘Žπ‘™π‘’π‘’ π‘œπ‘“ 𝑖𝑑 ≫ β‰ͺ π‘£π‘Žπ‘™π‘’π‘’ π‘œπ‘“ π‘›π‘Žπ‘šπ‘’ ≫ β‰ͺ π‘£π‘Žπ‘™π‘’π‘’ π‘œπ‘“ π‘‘π‘’π‘ π‘π‘Ÿπ‘–π‘π‘‘π‘–π‘œπ‘› ≫ β‰ͺ π‘£π‘Žπ‘™π‘’π‘’ π‘œπ‘“ π‘π‘œπ‘™π‘œπ‘Ÿ ≫

  • π‘”π‘’π‘‘πΆπ‘œπ‘™π‘œπ‘Ÿπ‘π‘Žπ‘šπ‘’: returns the name of the πΆπ‘œπ‘™π‘œπ‘Ÿ as a π‘†π‘‘π‘Ÿπ‘–π‘›π‘”. This method is simply the reverse implementation of π‘”π‘’π‘‘πΆπ‘œπ‘™π‘œπ‘Ÿ in the test class
  • π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ: numerically compares two objects of type π‘†β„Žπ‘Žπ‘π‘’. Returns the value 0 if both objects have the same π‘›π‘Žπ‘šπ‘’ and π‘π‘œπ‘™π‘œπ‘Ÿ. Use π‘”π‘’π‘‘πΆπ‘œπ‘™π‘œπ‘Ÿπ‘π‘Žπ‘šπ‘’ when comparing colors. Note that the 𝑖𝑑 and π‘‘π‘’π‘ π‘π‘Ÿπ‘–π‘π‘‘π‘–π‘œπ‘› fields are excluded here. Otherwise, return the results of the first mismatch comparison between π‘›π‘Žπ‘šπ‘’ then π‘π‘œπ‘™π‘œπ‘Ÿ. In other

words, if the two π‘›π‘Žπ‘šπ‘’ fields are the same return the results of comparing the two π‘π‘œπ‘™π‘œπ‘Ÿ fields. II. π‘Ίπ’‰π’‚π’‘π’†πŸπ‘« and π‘Ίπ’‰π’‚π’‘π’†πŸ‘π‘«:

  • Abstract classes which inherits from class π‘†β„Žπ‘Žπ‘π‘’.
  • The non‐default constructor initializes the class’ private fields
  • π‘‘π‘œπ‘†π‘‘π‘Ÿπ‘–π‘›π‘”: returns the same value described in the parent class but includes β„Žπ‘’π‘–π‘”β„Žπ‘‘, π‘€π‘–π‘‘π‘‘β„Ž, and π‘™π‘’π‘›π‘”π‘‘β„Ž The method must re‐use the parent class’ π‘‘π‘œπ‘†π‘‘π‘Ÿπ‘–π‘›π‘” implementation.
  • π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ numerically compares two objects of type π‘†β„Žπ‘Žπ‘π‘’2𝐷 (or π‘†β„Žπ‘Žπ‘π‘’3𝐷). Returns the value 0 if both objects have the same 𝑖𝑑, π‘›π‘Žπ‘šπ‘’, π‘‘π‘’π‘ π‘π‘Ÿπ‘–π‘π‘‘π‘–π‘œπ‘›, π‘€π‘–π‘‘π‘‘β„Ž, β„Žπ‘’π‘–π‘”β„Žπ‘‘, and π‘™π‘’π‘›π‘”π‘‘β„Ž (for π‘†β„Žπ‘Žπ‘π‘’3𝐷 only). The π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ in π‘†β„Žπ‘Žπ‘π‘’2𝐷 must re‐use the π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ from the π‘†β„Žπ‘Žπ‘π‘’ The π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ in π‘†β„Žπ‘Žπ‘π‘’3𝐷 must reuse the π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ from the π‘†β„Žπ‘Žπ‘’π‘’π‘π‘’2𝐷 class.
  • π‘”π‘’π‘‘π·π‘–π‘šπ‘’π‘›π‘ π‘–π‘œπ‘›π‘  : returns the values of the shape’s dimensions (π‘€π‘–π‘‘π‘‘β„Ž, β„Žπ‘’π‘–π‘”β„Žπ‘‘, and π‘™π‘’π‘›π‘”π‘‘β„Ž). Use precision 2 and separate each dimension with the an β€œπ‘‹β€.

III.Β Β  π‘Έπ’–π’‚π’…π’“π’Šπ’π’‚π’•π’†π’“π’‚π’

  • Represents 90Β° angle quadrilateral 2D shapes
  • Inherits from class π‘†β„Žπ‘Žπ‘π‘’
  • π‘Žπ‘Ÿπ‘’π‘Ž widthΒ Β Β  height
  • π‘π‘’π‘Ÿπ‘–π‘šπ‘’π‘‘π‘’π‘Ÿ 2Β Β Β Β Β Β Β Β Β Β Β Β  widthΒ Β Β  height

IV.Β Β  π‘Έπ’–π’‚π’…π’“π’Šπ’π’‚π’•π’†π’“π’‚π’πŸ‘π‘«

  • Represents 90Β° angle quadrilateral 3D shapes
  • π‘Žπ‘Ÿπ‘’π‘Ž 2 Β Β Β Β Β Β Β Β Β Β Β  Β widthΒ Β  heightΒ Β  widthΒ Β Β  lengthΒ Β  height Β  length
  • π‘π‘’π‘Ÿπ‘–π‘šπ‘’π‘‘π‘’π‘Ÿ 4Β Β Β Β Β Β Β Β Β Β Β Β  widthΒ Β Β  heightΒ Β  length

V.Β Β Β Β Β Β  π‘Ίπ’‰π’‚π’‘π’†π‘³π’Šπ’”π’•

  • Extends π‘—π‘Žπ‘£π‘Ž. 𝑒𝑑𝑖𝑙. π‘‡π‘Ÿπ‘’π‘’π‘†π‘’π‘‘
  • π‘Žπ‘‘π‘‘: checks if a similar π‘†β„Žπ‘Žπ‘π‘’ instance is already stored. If a similar object is found, the method returns false. If it is not, the object is added and the method returns π‘‘π‘Ÿπ‘’π‘’. YOU MUST USE the π‘π‘œπ‘›π‘‘π‘Žπ‘–π‘›π‘  method from π‘‡π‘Ÿπ‘’π‘’π‘†π‘’π‘‘ which requires that the method π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ is be overloaded properly. Do not write your own search code.
  • 𝑔𝑒𝑑2π·π‘†β„Žπ‘Žπ‘π‘’π‘ : returns a new set containing instances of supertype π‘†β„Žπ‘Žπ‘π‘’2𝐷 Hint: the π‘–π‘›π‘ π‘‘π‘Žπ‘π‘’π‘œπ‘“ operator is useful here.
  • 𝑔𝑒𝑑3π·π‘†β„Žπ‘Žπ‘π‘’π‘ : returns a new set containing instances of supertype π‘†β„Žπ‘Žπ‘π‘’3𝐷
  • π‘π‘Ÿπ‘–π‘›π‘‘πΉπ‘œπ‘Ÿπ‘šπ‘Žπ‘‘π‘‘π‘’π‘‘: prints a sorted and formatted table of all π‘†β„Žπ‘Žπ‘π‘’ objects (Figure 2). The list is automatically sorted by π‘π‘Žπ‘šπ‘’, then πΆπ‘œπ‘™π‘œπ‘Ÿ, then π·π‘–π‘šπ‘’π‘›π‘ π‘–π‘œπ‘› based on the π‘π‘œπ‘šπ‘π‘Žπ‘Ÿπ‘’π‘‡π‘œ implementation described earlier. π‘¨πŸ’π‘»π’†π’”π’•:
  • This is the provided test class. Your code should work with this class AS IS. Please DO NOT modify or submit this class and adhere to the names provided in the class’ UML diagram (Figure 1). You may, however, comment lines of code until you are ready to test the methods they invoke.
  • Your code’s output should match the output shown in Figure 2

Β 

Figure 1: Class UML Diagram

java.lang.UnsupportedOperationException: Unrecognized shape, skipping: 98241,BLACK,18.785:15.059,Sphere,A black sphere java.lang.UnsupportedOperationException: Unrecognized shape, skipping: 57057,BLACK,7.85:,Circle,A black sphere The list contains 29 Shape objects

There are 18 2-Dimensional shapes

There are 11 3-Dimensional shapes

+——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | IDΒ Β Β Β  | NameΒ Β Β Β Β Β Β  | ColorΒ Β  | DimensionsΒ Β Β Β Β Β Β Β Β Β Β Β Β  | DescriptionΒ Β Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 35779Β  | CubeΒ Β Β Β Β Β Β  | BlueΒ Β Β  | 39.20 X 46.91 X 27.15Β Β  | A blue cubeΒ Β Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 90238Β  | CubeΒ Β Β Β Β Β Β  | BlueΒ Β Β  | 77.60 X 54.66 X 8.34Β Β Β  | A blue cubeΒ Β Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 65701Β  | CubeΒ Β Β Β Β Β Β  | RedΒ Β Β Β  | 90.33 X 56.78 X 44.61Β Β  | A red cubeΒ Β Β Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 40433Β  | CubeΒ Β Β Β Β Β Β  | YellowΒ  | 94.89 X 43.88 X 21.47Β Β  | A yellow cubeΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 51060Β  | CuboidΒ Β  Β Β Β | BlackΒ Β  | 43.61 X 94.74 X 65.44Β Β  | A black cuboidΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 90955Β  | CuboidΒ Β Β Β Β  | BlueΒ Β Β  | 55.69 X 40.01 X 90.70Β Β  | A blue cuboidΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 83912Β  | CuboidΒ Β Β Β Β  | BlueΒ Β Β  | 8.09 X 45.01 X 96.79Β Β Β  | A blue cuboidΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 64851Β  | CuboidΒ Β Β Β Β  | GreenΒ Β  | 98.18 X 5.51 X 64.22Β Β Β  | A green cuboidΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 88174Β  | CuboidΒ Β Β Β Β  | GreenΒ Β  | 94.47 X 6.70 X 83.56Β Β Β  | A green cuboidΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 37951Β  | CuboidΒ Β Β Β Β  | RedΒ Β Β Β  | 70.19 X 32.90 X 94.36Β Β  | A red cuboidΒ Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 36830Β  | CuboidΒ Β Β Β Β  | YellowΒ  | 5.38 X 59.99 X 69.06Β Β Β  | A yellow cuboidΒ Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 48900Β  | RectangleΒ Β  | RedΒ Β Β Β  | 57.56 X 4.03Β Β Β Β Β Β Β Β Β Β Β  | A red rectangleΒ Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 60665Β  | RectangleΒ Β  | RedΒ Β Β Β  | 77.08 X 60.12Β Β Β Β Β Β Β Β Β Β  | A red rectangleΒ Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 90965Β  | RectangleΒ Β  | RedΒ Β Β Β  | 94.77 X 61.20Β Β Β Β Β Β Β Β Β Β  | A red rectangleΒ Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 72916Β  | RectangleΒ Β  | WhiteΒ Β  | 24.37 X 86.85Β Β Β Β Β Β Β Β Β Β  | A white rectangleΒ Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 35886Β  | RectangleΒ Β  | YellowΒ  | 65.95 X 51.71Β Β Β Β Β Β Β Β Β Β  | A yellow rectangleΒ Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 60895Β  | SquareΒ Β Β Β Β  | BlackΒ Β  | 87.86 X 39.68Β Β Β  Β Β Β Β Β Β Β | A black squareΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 67132Β  | SquareΒ Β Β Β Β  | BlackΒ Β  | 33.89 X 83.52Β Β Β Β Β Β Β Β Β Β  | A black squareΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 44356Β  | SquareΒ Β Β Β Β  | BlueΒ Β Β  | 57.32 X 54.03Β Β Β Β Β Β Β Β Β Β  | A blue squareΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 85368Β  | SquareΒ Β Β Β Β  | CyanΒ Β Β  | 70.95 X 41.82Β Β Β Β Β Β Β Β Β Β  | A cyan squareΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 99999Β  | SquareΒ Β Β Β Β  | CyanΒ Β Β  | 61.01 X 44.17Β Β Β Β Β Β Β Β Β Β  | A cyan squareΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 26449Β  | SquareΒ Β Β Β Β  | CyanΒ Β Β  | 84.56 X 77.16Β Β Β Β Β Β Β Β Β Β  | A cyan squareΒ Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 71002Β  | SquareΒ Β Β Β Β  | GreenΒ Β  | 23.65 X 12.55Β Β Β Β Β Β Β Β Β Β  | A green squareΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 78853Β  | SquareΒ Β Β Β Β  | RedΒ Β Β Β  | 7.28 X 60.85Β Β Β Β Β Β Β Β Β Β Β  | A red squareΒ Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 37376Β  | SquareΒ Β Β Β Β  | RedΒ Β Β Β  | 63.30 X 91.52Β Β Β Β Β Β Β Β Β Β  | A red squareΒ Β Β Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 25280Β  | SquareΒ Β Β Β Β  | WhiteΒ Β  | 5.54 X 0.04Β Β Β Β Β Β Β Β Β Β Β Β  | A white square Β Β Β Β Β Β | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 66544Β  | SquareΒ Β Β Β Β  | WhiteΒ Β  | 43.07 X 30.90Β Β Β Β Β Β Β Β Β Β  | A white squareΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 27982Β  | SquareΒ Β Β Β Β  | WhiteΒ Β  | 29.25 X 88.76Β Β Β Β Β Β Β Β Β Β  | A white squareΒ Β Β Β Β Β  | +——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+ | 76667Β  | SquareΒ Β Β Β Β  | YellowΒ  | 38.50 X 62.44Β Β Β Β Β Β Β Β Β Β  | A yellow squareΒ Β Β Β Β  |

+——–+β€”β€”β€”β€”-+β€”β€”β€”+β€”β€”β€”β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”β€”β€”-+

Figure 2: Test Class’ Output

Β 

Β Β Β Β Β Β Β Β Β Β Β Β Β Β Β  Β 

UML Diagram Legend

Symbol Description
Underlined Indicates a static member
Β  A private member (i.e. variable or method)
Β  A private final member (i.e. variable)
Β  A public field (i.e. variable or method)
Β  A public abstract member (i.e. variable or method)
Β  A public constructor
Β  A static public member
Β  An interface
Β  A public class
Β  A public abstract class
Β  A hollowed arrow indicates inheritance
Β  An open-ended arrow indicates composition
Β  A dotted line and hollowed arrow indicate class implementation

Β 

Β 

  • Assignment_4-akaieo.zip