blob: 82da9b16450ff84892bf270e9f3baa095fb04e36 (
plain) (
blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
class Vowels {
public static void main(String[] args) throws java.io.IOException{
int VA = 0;
int VE = 0;
int VI = 0;
int VO = 0;
int VU = 0;
int NV = 0;
try{
File f=new File("input.txt");
FileReader file = new FileReader(f);
BufferedReader input = new BufferedReader(file); //I miss unix pipes, they make life so much nicer
int c = 0;
while((c = input.read()) != -1){
char character = (char) c;
switch(character){
case 'A':
VA++;
break;
case 'a':
VA++;
break;
case 'E':
VE++;
break;
case 'e':
VE++;
break;
case 'I':
VI++;
break;
case 'i':
VI++;
break;
case 'O':
VO++;
break;
case 'o':
VO++;
break;
case 'U':
VU++;
break;
case 'u':
VU++;
break;
default:
NV++;
break;
}}
System.out.println("A " + VA);
System.out.println("E " + VE);
System.out.println("I " + VI);
System.out.println("O " + VO);
System.out.println("U " + VU);
System.out.println("No Vowels " + NV);
}catch(FileNotFoundException e) {
System.out.println("No Inputfile Provided");
}
}
}
//By msglm; Licensed under the AGPL v3
|