Question: Java Programming Customize any of the programs in Listings 13.7, 13.9 or 13.10, and create your own solution. For example, one of the programs was
Java Programming
Customize any of the programs in Listings 13.7, 13.9 or 13.10, and create your own solution. For example, one of the programs was to sort Rectangles. You could customize it to sort Triangles, or Circle.Make sure include the changes that you had made in your program purpose.
Listings:
13.7 TestEdible.java

13.9 ComparableRectangle.java
1 public class ComparableRectangle extends Rectangle 2 implements Comparable 13.10 SortRectangles.java 1 public class SortRectangles { 2 public static void main(String[] args) { 3 ComparableRectangle[] rectangles = { 4 new ComparableRectangle(3.4, 5.4), 5 new ComparableRectangle(13.24, 55.4), 6 new ComparableRectangle(7.4, 35.4), 7 new ComparableRectangle(1.4, 25.4)}; 8 java.util.Arrays.sort(rectangles); 9 for (Rectangle rectangle: rectangles) { 10 System.out.print(rectangle + " "); 11 System.out.println(); 12 } 13 } 14 }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
