converter - What is the Difference between JDK and JRE in beginners java? -
basically need tittle says dont understand topic , have test in week
hey coded you...
import java.util.scanner; public class piglatin { public static void main(string[] args) { scanner sc = new scanner(system.in); system.out.println("enter word."); string word = ""; word = sc.nextline(); { if(word.length() > 0) { if(containsvowels(word.substring(0,1))) { system.out.println(word+"way"); } else { if(containsvowels(word)) { system.out.println(word.substring(1,word.length())+word.substring(0,1)+"ay"); } else system.out.println("invalid"); } } system.out.println("enter word."); } while(!((word = sc.nextline()).equalsignorecase("done"))); sc.close(); } public static boolean containsvowels(string word) { string[] vowels = { "a","e","i","o","u" }; for(int = 0; < vowels.length; i++) { if(word.contains(vowels[i]) || word.contains(vowels[i].touppercase())) return true; } return false; } }
this not solve problem
"one other thing cant add code "if first vowel "u" , letter before "q" "u" goes end of word." example if type in question code, reads uestionqay. want estionquay."
you must try on own :) can review did see if work want see try that.
Comments
Post a Comment