Files
  • Main.java
  • Contact.class
  • Contact.java
  • Main.class
  • Sorts.class
  • Sorts.java
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public class Main{
//-----------------------------------------------------------------
// Creates an array of Contact objects, sorts them, then prints
// them.
//-----------------------------------------------------------------
public static void main (String[] args){
  Contact[] friends = new Contact[7];
  friends[0] = new Contact ("Giovanni", "Rojas", "854-777-8426");
  friends[1] = new Contact ("Mumkey", "Jones", "317-777-9542");
  friends[2] = new Contact ("Peter", "Griffen", "215-777-1596");
  friends[3] = new Contact ("Steve", "last", "688-777-1234");
  friends[4] = new Contact ("Banjo", "Kaziooe", "466-777-8462");
  friends[5] = new Contact ("Phelps", "Frank", "582-777-6548");
  friends[6] = new Contact ("Demari", "Black", "953-777-7542");
  Sorts.insertionSort(friends);
  for (int index = 0; index < friends.length; index++)
  System.out.println (friends[index]);
  }
}