The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
I started on the bare bones of this code but I am stuck. Â I am having trouble figuring out the rest. Â
Â
public class GenericPair
{
private F elementOne;
private S elementTwo;
Â
public(F firstPair, S secondPair)
{
this.elementOne = firstPair;
this.elementTwo = secondPair;
Â
public void setelementOne (F first)
{
this.elementOne = first;
Â
public void setelementTwo (S second)
{
this.elementTwo=second;
}
public F getelementOne ()
{
return elementOne;
}
public s getelementTwo ()
{
return elementTwo;
}
}
Â
Project 3 Description
Create an application that provides a solution for problem 20.8 In addition to requirements specified in the description. The class must satisfy the following
The application must create an ArrayList of 5 Pair objects and then display the contents in sorted order largest to smallest, based on the method used to compare "Pair" objects. The class only supports types that extend Number. Assume the "Pair" objects contain x, y coordinates. Therefore calculate the distance from a 0,0 coordinate to determine the sorting order (i.e., ascending, smallest distance to largest distance).
-----------