MCPcopy Create free account
hub / github.com/Hazrat-Ali9/Computer-Programming / main

Method main

Problem3.java:7–56  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

5public class Problem3 {
6
7 public static void main(String[] args) {
8 // TODO Auto-generated method stub
9 Scanner scan = new Scanner(System.in);
10 int[] volume;
11 int N;
12 String line;
13 String[] numbersInALineStr;
14 int[] numbersInALineStrInt;
15
16 N = scan.nextInt();
17 scan.nextLine();
18 volume = new int[N];
19
20 for (int i = 0; i < N; i++) {
21 line = scan.nextLine();
22 int volumeIndividual = 1;
23
24 numbersInALineStr = line.trim().split("\\s+");
25 numbersInALineStrInt = new int[numbersInALineStr.length];
26
27 for (int j = 0; j < numbersInALineStr.length; j++) {
28 numbersInALineStrInt[j] = Integer.parseInt(numbersInALineStr[j]);
29 }
30
31 for (int number : numbersInALineStrInt) {
32 while (number < 1 || number > 100) {
33 line = scan.nextLine();
34
35 numbersInALineStr = line.trim().split("\\s+");
36 numbersInALineStrInt = new int[numbersInALineStr.length];
37
38 for (int j = 0; j < numbersInALineStr.length; j++) {
39 numbersInALineStrInt[j] = Integer.parseInt(numbersInALineStr[j]);
40 }
41 }
42 }
43
44 for (int j = 0; j < 3; j++) {
45 volumeIndividual = volumeIndividual * numbersInALineStrInt[j];
46 }
47
48 volume[i] = volumeIndividual;
49 }
50 scan.close();
51
52 for (int number : volume) {
53 System.out.printf("%d\n", number);
54 }
55
56 }
57
58}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected