MCPcopy Index your code
hub / github.com/Hazrat-Ali9/Computer-Programming / main

Method main

Problem5.java:29–74  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

27 }
28
29 public static void main(String[] args) {
30 // TODO Auto-generated method stub
31 Scanner scan = new Scanner(System.in);
32 int[][] maxMin;
33 int N;
34 String line;
35 String[] numbersInALineStr;
36 int[] numbersInALineStrInt;
37
38 N = scan.nextInt();
39 scan.nextLine();
40 maxMin = new int[N][2];
41
42 for (int i = 0; i < N; i++) {
43 line = scan.nextLine();
44
45 numbersInALineStr = line.trim().split("\\s+");
46 numbersInALineStrInt = new int[numbersInALineStr.length];
47
48 for (int j = 0; j < numbersInALineStr.length; j++) {
49 numbersInALineStrInt[j] = Integer.parseInt(numbersInALineStr[j]);
50 }
51
52 for (int number : numbersInALineStrInt) {
53 while (number < 0 || number > 100) {
54 line = scan.nextLine();
55
56 numbersInALineStr = line.trim().split("\\s+");
57 numbersInALineStrInt = new int[numbersInALineStr.length];
58
59 for (int j = 0; j < numbersInALineStr.length; j++) {
60 numbersInALineStrInt[j] = Integer.parseInt(numbersInALineStr[j]);
61 }
62 }
63 }
64
65 maxMin[i][0] = getMax(numbersInALineStrInt);
66 maxMin[i][1] = getMin(numbersInALineStrInt);
67 }
68 scan.close();
69
70 for (int i = 0; i < maxMin.length; i++) {
71 System.out.printf("%d %d\n", maxMin[i][0], maxMin[i][1]);
72 }
73
74 }
75
76}

Callers

nothing calls this directly

Calls 2

getMaxMethod · 0.95
getMinMethod · 0.95

Tested by

no test coverage detected