Repository navigation
Expand file tree
/
Copy pathProgram9.java
More file actions
58 lines (54 loc) · 1.55 KB
/
Copy pathProgram9.java
File metadata and controls
58 lines (54 loc) · 1.55 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import java.util.Scanner;
public class Program9
{
public static void main (String args[]){
Scanner sc = new Scanner(System.in);
Class1 c1 = new Class1();
Class2 c2 = new Class2();
Class3 c3 = new Class3();
int rows =8;
int columns=5;
int array[][]= new int [rows][columns];
int count = 1;
int input=0;
int input1= -1;
System.out.println("2D ARRAY MANIPULATION ");
for(int i = 0; i<rows;i++){
for(int j = 0; j<columns;j++){
System.out.print("Input element "+count+": ");
count++;
try {
array[i][j]= sc.nextInt();
}
catch(Exception e){
System.out.println(e);
j--;
count--;
}
sc.nextLine();
}
}
c1.getSort(array);
System.out.println("Input number to search for");
try {
input1= sc.nextInt();
}
catch(Exception e){
System.out.println(e);
}
c2.getSearch(array,input1);
while((input<=0)||(input>columns)){
System.out.println("Input Column");
try {
input= sc.nextInt();
}
catch(Exception e){
System.out.println(e);
}
if((input<=0)||(input>=6))
System.out.println("Invalid");
}
input--;
c3.DisplayColumn(input,array);
}
}