
-----------------------------------
nelsonkkyy
Tue Nov 22, 2011 8:57 pm

array sort (rectangle x top left coordinate )
-----------------------------------


import java.awt.Rectangle;
/**
   SelectionSorter2 class sorts an array of Rectangles
   based on the x-coordinate of the top left corner of each rectangle.
   It uses the selection sort algorithm.
 */
public class SelectionSorter2
{
    private Rectangle
the above is the class file which didnt  run properly . Anyone can tell me wheres the problem?

main file



import java.util.* ;

public class SelectionSorterTester2
{
    public static void main(String

-----------------------------------
Tony
Tue Nov 22, 2011 9:15 pm

Re: array sort (rectangle x top left coordinate )
-----------------------------------

the above is the class file which didnt  run properly . Anyone can tell me wheres the problem?

in which way did it not run properly? What was the output? What output did you expect?

-----------------------------------
nelsonkkyy
Tue Nov 22, 2011 9:17 pm

Re: array sort (rectangle x top left coordinate )
-----------------------------------
output should be a set of a number sorted from the smallest to the largest number according to the rectangle top left x coordinates

-----------------------------------
Tony
Tue Nov 22, 2011 9:33 pm

RE:array sort (rectangle x top left coordinate )
-----------------------------------
and you get what instead?

-----------------------------------
nelsonkkyy
Tue Nov 22, 2011 9:35 pm

Re: array sort (rectangle x top left coordinate )
-----------------------------------
notings printed out cuz it has an error.
You cannot assign a "double" expression to a "java.awt.Rectangle" variable

-----------------------------------
Tony
Tue Nov 22, 2011 9:38 pm

RE:array sort (rectangle x top left coordinate )
-----------------------------------
That does sound like a problem. Something like
[code]
Rectangle a_rectangle = 42;
[/code]
doesn't make much sense (this is just an example of what might cause that error. Check the line number to see what you are doing there).
