Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 3: Enabling GeometricObject comparable(answer in java and need uml diagram) Problem Description: ( Enabling GeometricObject comparable ) Modify the GeometricObject class to implement the

Project 3: Enabling GeometricObject comparable(answer in java and need uml diagram)

Problem Description:

(Enabling GeometricObject comparable) Modify the GeometricObject class to implement the Comparable interface, and define a static max method in the GeometricObject class for finding the larger of two GeometricObject objects.

Java Comparable interface is used to order the objects of user-defined class.This interface is found in java.lang package and contains only one method named compareTo(Object). It provide single sorting sequence only i.e. you can sort the elements on based on single data member only. For example it may be rollno, name, age or anything else.

compareTo(Object obj) method

public int compareTo(Object obj): is used to compare the current object with the specified object.

Draw the UML diagram and implement the new GeometricObject class.

Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.

 

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

Step: 3

blur-text-image

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions