-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrings_code.java
More file actions
44 lines (34 loc) · 1.38 KB
/
Strings_code.java
File metadata and controls
44 lines (34 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.*;
public class Strings_code {
// ******************************************************
// Numbers.java
//
// Demonstrates selectionSort on an array of integers.
// ******************************************************
// --------------------------------------------
// Reads in an array of integers, sorts them,
// then prints them in sorted order.
// --------------------------------------------
public static void main (String[] args)
{
String[] 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 String[size];
System.out.println ("\nEnter the numbers...");
for (int i = 0; i < size; i++)
intList[i] = scan.next();
Strings.Insertionsort(intList,size);
System.out.println ("\nYour numbers in sorted order...");
for (int i = 0; i < size; i++)
System.out.print(intList[i] + " ");
System.out.println ();
Strings.selectionSort(intList);
System.out.println ("\nYour numbers in Decending order...");
for (int i = 0; i > size; i++)
System.out.print(intList[i] + " ");
System.out.println ();
}
}