Computers and Technology

Import java. util. Scanner; public class PigLatin {
public static void main(String args[]) {
Scanner console =new Scanner(System. in);
System. out. println("Please enter a word");
String phrase=console. nextLine();

System. out. println(eachWord(phrase));
}

public static String eachWord(String phrase) {
String help[]=phrase. split(" ");

for(int i=0; i
if (help[i].charAt(0) == 'a'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'e'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'i'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'o'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'u'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'A'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'E'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'I'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'O'){
return help[i] + "-ay";
}
if (help[i].charAt(0) == 'U'){
return help[i] + "-ay";
}
else {
return help[i].substring(1)+"-"+help[i].ch arAt(0)+"ay";
}

}
return "aoujbfgaiubsgasdfasd";
}

I need help with this Pig Latin Program. I want to split the string so each word can run through the method eachWord. I don't know how to revamp this!

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 17:30, kallee10
The forerunner to cell phones, pdas, and smartphones was
Answers: 1
image
Computers and Technology, 22.06.2019 21:30, aesthetickait
How do you take a green screen out of the video while editing?
Answers: 2
image
Computers and Technology, 24.06.2019 17:30, mikemofun9079
When you type january in a cell, then copy it using the fill handle to the cells below and the data automatically changes to february, march, april, and so on, what is this feature called? auto fill automaticcopy monthfill textfill
Answers: 1
image
Computers and Technology, 25.06.2019 00:30, jayzelgaspar8005
You are to write a series of steps that anyone could follow to solve the following three problems: 1. even odd a. assume that someone tells you a number (an integer number) b. you hear the number and respond with the word even or odd 2. average a. assume that someone tells you between 3 and 5 numeric values. b. you hear the numbers and respond with the average is some number 3. dog or cat a. explain to a child the differences between a dog and a cat. b. your explanation could be used by a child or anyone to distinguish the difference between a dog and a cat
Answers: 1
Do you know the correct answer?
Import java. util. Scanner; public class PigLatin {
public static void main(String args[]) {<...

Questions in other subjects:

Konu
Mathematics, 12.03.2021 21:30
Konu
English, 12.03.2021 21:30