Page 372 - Computer science 868 Class 12
P. 372
46
47 void display()
48 {
49 checkandfreq();
50 checkanfreq();
51 System.out.println("Frequency of 'and' in the sentence is " + countand);
52 System.out.println("Frequency of 'an' in the sentence is " + countan);
53 }
54
55 public static void main()
56 {
57 Scanner sc= new Scanner(System.in);
58 String sentence;
59 System.out.println("Enter a sentence");
60 sentence=sc.nextLine();
61 frequency ob = new frequency();
62 ob.accept(sentence);
63 ob.display();
64 }
65 }
The output of the preceding program is as follows:
Enter a sentence
It is all just good clean fun.
Frequency of ‘and’ in the sentence is 0
Frequency of ‘an’ in the sentence is 0
370370 Touchpad Computer Science-XII

