Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Expand the GeometricObject. This task has the following elements that are relevant to the learning outcomes of this module: - be able to create and

Expand the GeometricObject.

This task has the following elements that are relevant to the learning outcomes of this module:

- be able to create and use abstract classes - be able to use the classes Calendar and GregorianCalendar - be able to define common behavior for objects using interface - be able to define interfaces and classes that implement these - could use the Comparable interface

You should use the GeometricObject class that we have developed in the previous module. You should now further develop this by using interface and developing classes Triangle, Circle and Rectangle.

The program must:

  • GeometricObject classes:
    • It should be an abstract class so that it cannot be instituted.
    • It must implement the Comparable interface and the associated int compareTo () method. Comparable is the interface defined in the Java library, you should not write your own Comparable interface. Area is used for comparison of geometric objects, the object with the largest area is assumed to be greatest by comparison.
    • It should define three abstract methods, boolean equals (Object other), double getArea () and double getPerimeter (). These must be implemented by the children's classes.
    • The class must have a static GeometricObject max (GeometricObject obj1, GeometricObject obj2) method that returns the largest object. Tip: Use the compareTo method when comparing obj1 and obj2
    • Test class:
      • It should create two objects of each class of different sizes.
      • It should use the max method in GeometricObject to find the largest object of each type and print info about each.
      • It should find the largest object of the three largest objects found at the point above.
    • For the GeometricObject, Triangle, Rectangle and Circle classes see attached UML diagrams.
    • Example of the application's print is:
      The biggest circle: Circle Radius: 3.00 Created on: 2018-01-28 18:48:23 Color: white Is filled: no The biggest rectangle: Rectangle Width: 4.00 Height: 6.000000 Created on: 2018-01-28 18:48 : 23 Color: white Is filled: no The biggest triangle: Triangle Sides: 9.00, 10.00, 9.00 Created on: 2018-01-28 18:48:23 Color: white Is filled: no The biggest geometric object is: Triangle Sides: 9.00, 10.00, 9.00 Created on: 2018-01-28 18:48:23 Color: white Is filled: no
    • UML Chart for Class:image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

Solve the equation. Find all real solutions. 1+8=0

Answered: 1 week ago

Question

Define prejudice, and identify its social and emotional roots.

Answered: 1 week ago

Question

Decision Making in Groups Leadership in Meetings

Answered: 1 week ago