Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Daily4 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.println("Please enter a phrase you would like translated");
- String phrase = in.nextLine();
- char buffer;
- String translate[] = phrase.split(" ");
- for (String pos : translate) {
- char pos0 = pos.charAt(0);
- if (pos0 == 'a' || pos0 == 'e' || pos0 == 'i' || pos0 == 'o' || pos0 == 'u') {
- pos += "way";
- break;
- } else {
- for (int i = 0; i < pos.length(); i++) {
- char posIndex = pos.charAt(i);
- if (posIndex != 'a' || posIndex != 'e' || posIndex != 'i' || posIndex != 'o' || posIndex != 'u') {
- buffer = pos.charAt(i);
- pos = pos.substring(i + 1, pos.length());
- pos += buffer;
- } else {
- break;
- }
- }
- pos += "way";
- }
- System.out.printf("%s ", pos);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement