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

Method main

Problem16.java:22–99  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

20 }
21
22 public static void main(String[] args) {
23 // TODO Auto-generated method stub
24 Scanner input = new Scanner(System.in);
25 String line;
26 int lineLength;
27 String[] lineInArray;
28 String[] lines;
29
30 int N = input.nextInt();
31
32 while (N < 1) {
33 N = input.nextInt();
34 }
35
36 lines = new String[N];
37
38 for (int i = 0; i < N; i++) {
39 line = input.nextLine();
40
41 lineLength = line.trim().split("\\s+").length;
42 lineInArray = line.trim().split("\\s+");
43
44 boolean allFine = true;
45
46 for (String word : lineInArray) {
47 if (word.length() < 1 || word.length() > 20) {
48 allFine = false;
49 break;
50 }
51 }
52
53 while (lineLength < 1 || lineLength > 10 || allFine == false) {
54 line = input.nextLine();
55
56 lineLength = line.trim().split("\\s+").length;
57 lineInArray = line.trim().split("\\s+");
58
59 allFine = true;
60
61 for (String word : lineInArray) {
62 if (word.length() < 1 || word.length() > 20) {
63 allFine = false;
64 break;
65 }
66 }
67
68 }
69 lines[i] = line;
70
71 }
72 input.close();
73
74 for (int i = 0; i < lines.length; i++) {
75 ArrayList<String> wordsList = new ArrayList<String>();
76 lineInArray = lines[i].trim().split("\\s+");
77
78 for (String word : lineInArray) {
79 wordsList.add(word);

Callers

nothing calls this directly

Calls 2

getFactorialMethod · 0.95
addMethod · 0.45

Tested by

no test coverage detected