-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfol.java
56 lines (47 loc) · 1.41 KB
/
fol.java
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
import java.io.*;
import java.util.*;
import java.util.Iterator;
public class Fol {
public static void main(String args[]) {
String A;
Scanner sc = new Scanner(System.in);
ArrayList<String> arr_uni =new ArrayList<String>();
ArrayList<String> arr_ext = new ArrayList<String>();
System.out.print("Enter the Sentence :");
A = sc.nextLine();
arr_ext.add("someone");
arr_ext.add("something");
arr_ext.add("each");
arr_ext.add("some");
arr_ext.add("any");
arr_uni.add("all");
arr_uni.add("everyone");
arr_uni.add("anything");
arr_uni.add("everything");
arr_uni.add("anyone");
String check_uni="";
String check_ext="";
String[] words = A.split(" ");
int i = 0;
for (String word :words) {
for(i = 0; i<arr_uni.size(); i++) {
if (arr_uni.get(i).equals(word.toLowerCase())) {
System.out.println("Universal Quantifier :"+word);
check_uni="Found";
}
}
for(i = 0; i<arr_ext.size(); i++) {
if (arr_ext.get(i).equals(word.toLowerCase())) {
System.out.println("Existential Quantifier :"+ word);
check_ext="Found";
}
}
}
if (check_uni != "Found" && check_ext !="Found") {
System.out.println("No Quantifier Found !!");
}
else if (check_uni == "Found" && check_ext =="Found") {
System.out.println("Both Quantifier Found !!!");
}
}
}