Software Design Laboratory Exercise 2 Solution

$35.00 $29.00

Consider the class hierarchy in Exercise 1. 1- Amend the hierarchy of Java classes in Exercise 1 as follows: MyPolygon is_a MyShape; MyRectangle is_a MyShape MyOval is_a MyShape; MyCircle is_a MyOval; 2- Interface MyShapeInterface, interface MyPositionInterface, and interface MyShapePositionInterface are specified in connection with the class hierarchy. 3- Interface MyShapeInterface includes appropriate abstract, static, and/or…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)

Consider the class hierarchy in Exercise 1.

1- Amend the hierarchy of Java classes in Exercise 1 as follows:

MyPolygon is_a MyShape;

MyRectangle is_a MyShape

MyOval is_a MyShape;

MyCircle is_a MyOval;

2- Interface MyShapeInterface, interface MyPositionInterface, and interface MyShapePositionInterface are specified in connection with the class hierarchy.

3- Interface MyShapeInterface includes appropriate abstract, static, and/or default methods that describe the intrinsic functions and behaviors of the specific object types of the class hierarchy, including:

  1. getArea — describes the area of an object in the class hierarchy;

  2. getPerimeter — describes the perimeter of an object in the class hierarchy.

4- Interface MyPositionInterface includes appropriate abstract, static, and/or default methods that describe the positional functions and behaviors of the specific object types of the class hierarchy, including:

  1. getPoint – returns the point (x, y);

  2. moveTo – moves point (x, y) to point (x +x, y +y);

  3. distanceTo – returns distance from point (x, y) to a point;

5- The abstract class MyShape implements interface MyShapePositionInterface which extends interface MyShapeInterface and interface MyPositionInterface. Interface MyShapePositionInterface includes appropriate abstract, static, and/or default methods that describe the functions and behaviors of the specific object types of the class hierarchy, including:

  1. getBoundingBox — returns the bounding rectangle of an object in the class hierarchy;

  1. doOverlap — returns true if two objects in the class hierarchy overlap.

6- Use JavaFX graphics and the class hierarchy to build a class Application that processes polymorphically the subclasses in the hierarchy to draw the geometric object shown, subject to the following additional requirements:

  1. The code is applicable to canvases of variable height and width;

  1. The dimensions of the shapes are proportional to the smallest dimension of the canvas;

  1. The rectangles and ovals are filled with different colors of your choice.

Software Design Laboratory Exercise 2 Solution
$35.00 $29.00