public class PigLatinTranslatorMain i @param args the command line arguments pub
ID: 3891524 • Letter: P
Question
public class PigLatinTranslatorMain i @param args the command line arguments public static void main (String[] args) i 7 TODO code application logic here PígLatinTranslator pigLatinTranslator = new P?gLatinTranslator(); //This will read user input line by line Scanner scanner = new Scanner (System.in); System.out.println("Welcome to the Pig Latin Translator" //run loop until user enter "exit" while.txueld System.out.print ("Enter a string to translate:") //read next line. String string scanner.nextLine ): if (string.trim0.equals ("exit")) System.out.println ("Good Bye! "): breaki System.out.print ("Enter a string to represent "Vowels": " String vowels scanner.nextine pigLatinTranslator.setVowels (vowels) System.out.println ("Translated string: " pigLatinTranslator.translatestring (string))Explanation / Answer
You are getting these errors becuase your code is not present inside any function. in your code, all the coding statements are present directly inside the class PigLatinTranslatorMain instead of main function.
You need to put everything from "PigLatinTranslator pigLatinTranslator = new PigLatinTranslator()....." to System.out.println("Translated string:" + pigLatinTranslator.translateString(string))" inside public static void main(String args[]) function.
Then these errors will disappear.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.