[Solved] CSC22100 Assignment 1

$25

File Name: CSC22100_Assignment_1.zip
File Size: 197.82 KB

SKU: [Solved] CSC22100 Assignment 1 Category: Tag:
5/5 - (1 vote)

5/5 – (1 vote)

1- Create a hierarchy of Java classes as follows:

MyLine is_a MyShape; MyRectangle is_a MyShape; MyOval is_a MyShape.

Class MyShape:

Class MyShapeis the hierarchys superclass and extends the Java class Object. An implementation of the class defines a reference point (x, y) and the color of the shape. The class includes appropriate class constructors and methods, including methods that perform the following operations:

  1. getX, getY return the x- and y-coordinates of the reference point of the MyShape object;
  2. area, perimeter return the area and perimeter of the object.. MyShape

c.d. draw draws a MyShape object.

These methods must

be overridden in each subclass in the hierarchy

methods return zero.

toString

returns the objects description as a String. This method must be

overridden in each subclass in the hierarchy;

This method must be overridden in each subclass

object, it paints the drawing canvas in the color

For the

. Class MyLine:

MyShape

Class MyLine extends class MyShape. The MyLine object is a straight line segment defined by the endpoints (x1, y1) and (x2, y2). The MyLine object may be of any color. The class includes appropriate class constructors and methods that perform the following operations:

  1. length returns the length of the MyLine object;
  2. xAngle returns the angle (in degrees) of the MyLine object with the x-axis;

object, the

in the hierarchy. For the

specified

c. toString returns a string representation of the MyLine object, including the lines endpoints, length, and angle with the x-axis;

d. draw draws a MyLine object.

Class MyRectangle:

Class MyRectangle extends class MyShape. The MyRectangle object is a rectangle of height h and width w, and a top left corner point p(x, y), and may be filled with a color. The class includes appropriate class constructors and methods, including methods that perform the following operations:

  1. getX, getY, getWidth, getHeight return the width, height of the MyRectangle object
  2. toString returns a string representation of the MyRectangle object: top left corner point, width, height, perimeter, and area;
  3. draw draws a MyRectangle object of height h and width w, anchored at p(x, y).

Class MyOval:

Class MyOval extends class MyShape. The MyOval object is defined by an ellipse within a rectangle of height h and width w, and a top left corner point p(x, y). The MyOval object may be filled with a color. The class includes appropriate class constructors and methods, including methods that perform the following operations:

  1. getX, getY, getA, getB return the x- and y-coordinates of the center point and abscissa of the MyOval object;
  2. toString returns a string representation of the MyOval object: axes lengths, perimeter, and area;
  3. draw draws a MyOval object.
  4. 2- Use JavaFX graphics and the class hierarchy to draw a geometric configuration comprised of a sequence of alternating concentric ovals and their inscribed rectangles as illustrated below, subject to the following additional requirements:
    1. The code is applicable to canvases of variable height and width;
    2. The dimensions of the shapes are proportional to the smallest dimension of thecanvas;
    3. The ovals and rectangles are filled with different colors of your choice, specifiedthrough a MyColor enum reference type.
  5. 3- Explicitly specify all the classes imported and used in your Java code.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSC22100 Assignment 1
$25