subject

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!

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 22:00
Matlab question: use switch and anythe lottery game matches three different integer numbers between 1 and 10. winning depends on how many matching numbers are provided by a player. the player provides three different integers between 1 and 10.if there is a match of all 3 numbers, the winning $ 1000.if there is a match with 2 numbers, the winning $ 10.if there is a match of all with 1 numbers, the winning $ 1.with no match, the winning is $0.write a function lottery3 that checks three numbers provided by a player and determine the winning amount. if the user mistakenly enters same number twice/thrice and if that number matches one of the winning numbers, the code should count that number only once and display correct result. the player doesn’t have to guess the order of numbers.the input to the function lottery3 can have up to two input arguments. the first input argument is a row array numbers with 3 numbers. if the second argument input testcode is present, and is a row vector of 3 values, the function lottery3 uses the code in testcode as the three winning numbers (the test must be three different integer numbers between 1 and 10), else three different numbers will be automatically generated by testcode.the ouput should return the variable winnings and the three winning numbers in the row array winnumbers.hint: make use of the internal function any.restriction: the function must use switch-case statements to determine the winning.example #1: winning = lottery3( [1,2,1],[1,2,3])produceswinning =10example #2: [winning,winnumbers] = lottery3( [1,2,3])produceswinning =3winnumbers =8 5 3
Answers: 1
question
Computers and Technology, 21.06.2019 23:30
Me2540 week 5 assignment what do i want to know?
Answers: 1
question
Computers and Technology, 23.06.2019 04:10
2pointswho was mikhail gorbachev? oa. a russian leader who opposed a coupob. a polish leader who founded the labor union "solidarityoc. a soviet leader who called for a closer relationship with the unitedstates, economic reform, and a more open societyd. a soviet leader who called for more oppression in the soviet union
Answers: 3
question
Computers and Technology, 23.06.2019 09:30
Name the range function that would generate the following list of integers values: 0,1,2,3,4,5.
Answers: 1
You know the right answer?
Import java. util. Scanner; public class PigLatin {
public static void main(String args[]) {<...
Questions
question
Mathematics, 17.08.2021 07:30
question
English, 17.08.2021 07:30
question
Health, 17.08.2021 07:30
question
Mathematics, 17.08.2021 07:30
question
Mathematics, 17.08.2021 07:30
question
Social Studies, 17.08.2021 07:40
question
Mathematics, 17.08.2021 07:40
question
Mathematics, 17.08.2021 07:40
Questions on the website: 13722359