Created
December 5, 2012 19:18
-
-
Save applegateaustin/4218650 to your computer and use it in GitHub Desktop.
if character equal a, e, i, o, u replace it with that letter capitalized times 3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
import java.lang.*; | |
import java.io.*; | |
public class vowles { | |
public static void main(String[] args) { | |
Scanner kb = new Scanner(System.in); | |
System.out.println("Please enter the name of the file: "); | |
String usersFile = kb.nextLine(); | |
try { | |
FileReader f = new FileReader(usersFile); | |
BufferedReader in = new BufferedReader(f); | |
while(in.ready()) { | |
String currentLine = " "; | |
currentLine = in.readLine(); | |
for(int i = 0; i < currentLine.length(); i++) { | |
if(currentLine.charAt(i) == 'a') { | |
System.out.print("AAA"); | |
} | |
if(currentLine.charAt(i) == 'e') { | |
System.out.print("BBB"); | |
} | |
if(currentLine.charAt(i) == 'i') { | |
System.out.print("III"); | |
} | |
if(currentLine.charAt(i) == 'o') { | |
System.out.print("OOO"); | |
} | |
if(currentLine.charAt(i) == 'u') { | |
System.out.print("UUU"); | |
} | |
if(currentLine.charAt(i) != 'a' || currentLine.charAt(i) != 'e' ||currentLine.charAt(i) != 'i' ||currentLine.charAt(i) != 'o' ||currentLine.charAt(i) != 'u' ) { | |
System.out.print(currentLine.charAt(i)); | |
} | |
} | |
} | |
} | |
catch(IOException e) { | |
System.out.println("Error: " + e); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment