URGENtt!! You are asked to write a java class named "Kume". The UML class diagram of the Kume class is as follows. 3 The elements in the set are kept in an ArrayList. The constructor of the class takes an array of int and adds the elements of this array to the ArrayList named al. The add() method adds an integer it takes as a parameter to the get element. The delete() method deletes an Integer object that it takes as a parameter from the get element, returns true if it can be deleted, otherwise false. The print() function prints the elements of the set to the console. The compareTo() method is inherited from the Object class and is suppressed, and compares the get element of the Set object, which it takes as a parameter, with the retrieve element of the current set object in terms of content (the order of the elements is not important). It returns 1 if both sets contain the same elements, 0 otherwise.   Below is a test code that creates two objects from the Kume class and performs various operations on them. import java.util.ArrayList;   public class Final_question3 { public static void main(String[] args) { Kume k1 = new Kume(new int[]{5, 3}); Kume k2 = new Kume(new int[]{3, 2, 5, 7}); k1.print(); k2.print(); if(k1.compareTo(k2) == 1) System.out.println("The sets are the same"); else System.out.println("The sets are different"); k1.add(2); k1.print(); k2.sil(7); k2.print(); if(k1.compareTo(k2) == 1) System.out.println("The sets are the same"); else System.out.println("The sets are different"); } }   Console output:   Cluster: [5, 3] Cluster: [3, 2, 5, 7] Clusters are different Cluster: [5, 3, 2] Cluster: [3, 2, 5] Clusters are the same

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

URGENtt!!

You are asked to write a java class named "Kume". The UML class diagram of the Kume class is as follows.

3

The elements in the set are kept in an ArrayList. The constructor of the class takes an array of int and adds the elements of this array to the ArrayList named al. The add() method adds an integer it takes as a parameter to the get element. The delete() method deletes an Integer object that it takes as a parameter from the get element, returns true if it can be deleted, otherwise false. The print() function prints the elements of the set to the console. The compareTo() method is inherited from the Object class and is suppressed, and compares the get element of the Set object, which it takes as a parameter, with the retrieve element of the current set object in terms of content (the order of the elements is not important). It returns 1 if both sets contain the same elements, 0 otherwise.

 

Below is a test code that creates two objects from the Kume class and performs various operations on them.

import java.util.ArrayList;

 

public class Final_question3 {

public static void main(String[] args) {

Kume k1 = new Kume(new int[]{5, 3});

Kume k2 = new Kume(new int[]{3, 2, 5, 7});

k1.print();

k2.print();

if(k1.compareTo(k2) == 1)

System.out.println("The sets are the same");

else

System.out.println("The sets are different");

k1.add(2);

k1.print();

k2.sil(7);

k2.print();

if(k1.compareTo(k2) == 1)

System.out.println("The sets are the same");

else

System.out.println("The sets are different");

}

}

 

Console output:

 

Cluster: [5, 3]

Cluster: [3, 2, 5, 7]

Clusters are different

Cluster: [5, 3, 2]

Cluster: [3, 2, 5]

Clusters are the same

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education