summaryrefslogtreecommitdiffstats
path: root/Java/Vowels.java
diff options
context:
space:
mode:
Diffstat (limited to 'Java/Vowels.java')
-rw-r--r--Java/Vowels.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/Java/Vowels.java b/Java/Vowels.java
new file mode 100644
index 0000000..82da9b1
--- /dev/null
+++ b/Java/Vowels.java
@@ -0,0 +1,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