Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Translate into Java Eclipse code) cinterface Element toolean .remove(Elemben .getElement Element Abstract Element name: String element court Int into String elements Collection name: Sering Collection(String,

(Translate into Java Eclipse code) image text in transcribed
image text in transcribed
cinterface Element toolean .remove(Elemben .getElement Element Abstract Element name: String element court Int into String elements Collection name: Sering Collection(String, in adulis Abstracttist) boolean remove Abstract:boolean + addToLististatist, Element) boolean * removeFromlist(Abstractist Element boolean +reverse Avoid counts Elemento: int Strings Abstractisering, in equals(Object) hoolean toString String Element Elementin String) (jebolan toString String Unique Ordinary + Unique String.In +reverse void OrdinaryStringit countlement) Element class: Attributes: o id: the id of the element o info: the info of the element Methods: o Element(): default constructor o Element(int id, String info): constructor o equals(Object other): compares two objects of type Element based on their id and returns the result of the equality otoString(): returns a string representing the element List interface: . Methods: o add(Element e): adds e to the list in the following ways: UniqueList: adds e if there's space and it isn't already on the list OrdinaryList: adds e if there's space o remove(Element e): removes e from the list in the following ways: Unique List: removes e if it's in the list while maintaining the order OrdinaryList: removes e if it exists in the list and replaces it with the last element if possible o getElement(int index): returns the element at index if possible AbstractList class: Attributes: o name: the name of the list Methods: o AbstractList(String name, int size): constructor o equals(Object other): compares two objects of type AbstractList based on their name and returns the result of the equality otoString(: returns a string representing the list and its elements Unique List class: Methods: o UniqueList(String name, int size): constructor reverse(): reverses the order of the elements in the list. Example:(1", 2, 3. ..., ithith, i-Ith, i-2th, ..., 1") do this in-place Ordinary List class: Methods: o OrdinaryList(String name, int size): constructor o count(Element e): returns the number of occurrences of the element e in the list . Collection class: Attributes: o name: the name of the collection Methods: o Collection(String name, int size): constructor o addList(AbstractList 1): adds the list to the collection if there's space and it's not already there o removeList(AbstractList I): removes the list / from the collection if it is in the collection and replaces it with the last list addToList(AbstractList 1, Element e): adds e to list! o removeFromList(AbstractList I, Element e): removes e from the list if possible o reverse AllO: reverses all the unique lists in the collection o count All(Element e): returns the number of occurrences of the elemente in all the ordinary lists in the collection otoString(): returns a string representing the collection and its lists Exercise 1: Translate into Java code all the previous classes & interfaces. Exercise 2: Write a main method and test all the previous functionalities

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

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

3. Is there opportunity to improve current circumstances? How so?

Answered: 1 week ago

Question

2. How will you handle the situation?

Answered: 1 week ago