Create a Java class using generics: Trio

Cancelado Publicado hace 7 años Pagado a la entrega
Cancelado Pagado a la entrega

**Would have to be completed with 12 hours**

◦ Objects of this class hold three unordered items of the same type. 

◦ A Trio object is unordered.

◦ For example, the Trio (3, 4, 5) is considered the same as the Trio (4, 5, 3) and the Trio ("hi", "bye", "hello") is considered the same as the Trio ("hello", "hi", "bye").

◦ The order doesn't matter. (This is like a set in mathematics.)

◦ Use generics to ensure that the three objects are of the same type. 

◦ For example, a Trio can hold three Integers or it could hold three Strings or it could hold three Students, etc.

◦ A Trio could not, however, hold two Integers and a String.

◦ Write this class using generics. Here is the class header: public class Trio<T>

Requirements

Your class must compile (10 points) and have the following:

◦ (10 points) instance data for the three items

◦ (10 points) a constructor to create the object by sending three items as parameters

◦ (10 points) getters and setters for each item in the trio

◦ (10 points) a toString method that returns a text representation of the trio 

◦ (15 points) a contains method that returns whether or not the trio contains an item sent in as a parameter

◦ (15 points) a method called sameItems that returns true if the three items are the same as each other, meaning they are equal to each other (not aliases, but equal- logically equivalent), and false otherwise

◦ For example, invoking sameItems on the Trio (3, 3, 3) will return true. Invoking sameItems on the Trio (3, 4, 4) will return false.

◦ (20 points) an equals method that overrides the equals method of the Object class.

◦ The method returns true if the current Trio holds the same three items in any order as the Trio sent as a parameter and false otherwise.

Extra Credit (20 points)

◦ implement the Comparable interface

◦ order Trio objects by the smallest item in each Trio

◦ For example, (3, 1, 4) is less than (2, 6, 4) because the smallest item in the first Trio (1) is less than the smallest item in the second Trio (2)

◦ Hint: make a private helper method to find the smallest item in any Trio.

◦ Note that there are other ways you could reasonable compare Trio objects- but this is the way you are required to do it for the extra credit.

◦ To compile, change the class header and method header to the following.

◦ Essentially, these changes mean that you are requiring the data type T to implement Comparable as well.

◦ That matters because it means you can invoke compareTo on the items in the Trio!

◦ The "?" is called a wildcard and is related to bounds in generics. This is not information you are responsible for in our course. For now, you can just use it.

public class Trio<T extends Comparable<? super T>> implements Comparable<Trio <T>>

public int compareTo(Trio<T> otherTrio) {

Testing and Submission

I have provided a driver program that you can use to test your class. You might want to add additional code, but you can use this driver program as a starting point for testing.

Review the Assignment Submission Guidelines. Most importantly, make sure your code compiles- code that does not compile will receive a zero.

If submitting as a group, submit one assignment only through one group member's Insight account. Put the names of all group members in Java comments at the top of each Java file.

Java JavaScript Arquitectura de software

Nº del proyecto: #11400282

Sobre el proyecto

20 propuestas Proyecto remoto Activo hace 7 años

20 freelancers están ofertando un promedio de $27 por este trabajo

DucNA

Hi there, I'm a senior software developer who have over 250 completed projects and my account is qualified by this site (my page: https://www.freelancer.com/u/DucNA.html). Could you please send (or discuss with Más

$30 USD en 0 días
(268 comentarios)
6.6
utkarshkatiyar19

A proposal has not yet been provided

$25 USD en 1 día
(213 comentarios)
6.7
quanlitysource

A proposal has not yet been provided

$25 USD en 1 día
(82 comentarios)
5.7
dipakjadhav08

A proposal has not yet been provided

$25 USD en 0 días
(69 comentarios)
5.1
owenzhu

Java professional, good at concurrency and multi-thread, network, back-end server and web server, MySQL/mongodb, hadoop eco systems

$25 USD en 1 día
(4 comentarios)
3.5
hoangduong97

Hello, I am experienced and specialized in C/C++ and Java programming, I have experience in Android. I have taken part in many competitions, including national competition, in which I won 2nd prize. I am currently a Co Más

$25 USD en 1 día
(3 comentarios)
0.9
EdgarHill

Hi, This is my final bid.. I have read your project description. We are a team of experts and professionals. We are ready to work for you. Further we will discuss. Regards Edgar (Blunex Technologies)

$14 USD en 1 día
(2 comentarios)
0.1
gemxiezl

I am a Teaching Assistant for a Java class in Singapore. I am quite sure your program including the extra functions can be done in 1 to 2 hours. If you choose me, I will start coding right now.

$23 USD en 1 día
(1 comentario)
0.2
kisielisviktoras

Hello, Can provide all the implementation with max score. Following java coding conventions on proffesional level. Update: Code is already written, test passes.

$15 USD en 0 días
(0 comentarios)
0.0
abhishekguptabxr

I have very good command on core java & Collection. I can easily do this on time like you want. I am new on freelancer but my knowledge isn't.

$34 USD en 1 día
(0 comentarios)
0.0
giuseppepotrino

I'm a computer engineer and I'm specialized in Java language. In my academic period, I worked on many Java projects

$15 USD en 0 días
(0 comentarios)
0.0
PriyaS10

I have an two year of experience on JAVA. And in my project I have created many generic classes. I have a good programming skills and able to do that project.

$30 USD en 0 días
(0 comentarios)
0.0
erhmutlu

I am experienced in Java and developing software systems. I have been working as a Software Engineer for 1 year. I will do this task quick and perfectly.

$21 USD en 0 días
(0 comentarios)
0.0
conarmcgill

I graduated with a Computer Science degree from Carleton University and was a Teaching Assistant there for several years. Contact me with any questions.

$20 USD en 1 día
(0 comentarios)
0.0
yogendrachauhan0

A proposal has not yet been provided

$28 USD en 2 días
(0 comentarios)
0.0