[Solved] CSE 241/505- HW7- Write a Java Shape hierarchy

$25

File Name: CSE_241/505-_HW7-_Write_a_Java_Shape_hierarchy.zip
File Size: 433.32 KB

SKU: [Solved] CSE 241/505- HW7- Write a Java Shape hierarchy Category: Tag:
5/5 - (1 vote)

CSE 241/505Object Oriented ProgrammingFall 2018-Homework # 7Your First Java Program

In this homework, you will write a Java Shape hierarchy that you wrote already for HW5 in C++.Interface Shape defines at least the following method. area that returns the area of the shape perimeter that returns the perimeter Functions increment and decrement for incrementing and decrementing the shape positions by 1.0. This interface implements the Comparable interface to compare shapes with respect to their areas. Draw takes a Graphics object as parameter and draws the shape. This method will be called from the paintComponent method of a JPanel object.Class Rectangle, Triangle, Circle and ComposedShape all implement the Shape interface. They behave like the classes in HW3. Class ComposedShape keeps an array of Shape references for the shape elements.Polygon is an abstract class that implements. PolygonVect and PolygonDyn are two concrete classes that derive from Polygon class. One of them uses Collection class ArrayList vectors to keep the 2D points, the other uses Java arrays to keep the 2D points.We also define the following static methods in a separate class Method drawAll takes an array of Shape references and draws all shapes to an JPanel Method convertAll takes an array of Shape references, converts all shapes to Polygons and returns a new array with the new shapes. Method sortShapes takes an array of Shapes and increasingly sorts them with respect to their areas.Use the program that our TA Ahmet Soyyiit showed you during the PS to draw this shape hierarchyIn UML diagrams and submit the results.

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] CSE 241/505- HW7- Write a Java Shape hierarchy
$25