// Program Name:
Numbers.java
// Course:
CSE 1302J
// Student Name:
Bradley Shedd
// Assignment Number:
Lab#5
// Due Date:
10/11/2010
// Purpose:
Demonstrates selectionSort on an array
//
of integers.
// ******************************************************
// Numbers.java
// ******************************************************
import java.util.Scanner;
public
class
Numbers
{
//
--------------------------------------------
// Reads in an array of integers,
sorts them,
// then prints them in sorted order.
// --------------------------------------------
public
static
void
main (String[] args)
{
//
int[] intList;
Integer[] intList;
int
size;
Scanner scan =
new
Scanner(System.in);
System.out.print ("\nHow
many integers do you want to sort? ");
size = scan.nextInt();
//intList = new int[size];
intList =
new
Integer[size];
System.out.println ("\nEnter
the numbers...");
for
(int i = 0; i < size; i++)
intList[i] = scan.nextInt();
Sorting.insertionSort(intList);//changed
from selectionSort
System.out.println ("\nYour
numbers in sorted order...");
for
(int i = 0; i < size; i++)
System.out.print(intList[i] +
" ");
System.out.println ();
}
}