Pig latin Java program with try-catch, translation passed though function Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Java Try Catch Finally blocks without CatchHow to pass a function as a parameter in Java?Java Inventory Program problemsHow can I “delimit” an integer from a given string?Java Pig Latin sentence translator using Queueswhile + Scanner with System.in + hasNextMy program gives me java.lang.ArrayIndexOutOfBoundsException: 1Keep getting this error message for my RockPaperScissor Program. How do I fix this error?Best way to add an input enter part(scanf) into a java function returns arrayPig-English Translate Program Displaying Incorrectly

How to count in linear time worst-case?

Seek and ye shall find

What is this word supposed to be?

Is it acceptable to use working hours to read general interest books?

Arriving in Atlanta after US Preclearance in Dublin. Will I go through TSA security in Atlanta to transfer to a connecting flight?

With indentation set to `0em`, when using a line break, there is still an indentation of a size of a space

"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?

Do I need to protect SFP ports and optics from dust/contaminants? If so, how?

How do I check if a string is entirely made of the same substring?

Does Feeblemind produce an ongoing magical effect that can be dispelled?

Does Mathematica have an implementation of the Poisson Binomial Distribution?

Refugee travel document from Spain to US

Why does the Cisco show run command not show the full version, while the show version command does?

Book with legacy programming code on a space ship that the main character hacks to escape

All ASCII characters with a given bit count

What was Apollo 13's "Little Jolt" after MECO?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

Check if a string is entirely made of the same substring

Are these square matrices always diagonalisable?

My admission is revoked after accepting the admission offer

c++ diamond problem - How to call base method only once

Putting Ant-Man on house arrest

Is Bran literally the world's memory?

What *exactly* is electrical current, voltage, and resistance?



Pig latin Java program with try-catch, translation passed though function



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Java Try Catch Finally blocks without CatchHow to pass a function as a parameter in Java?Java Inventory Program problemsHow can I “delimit” an integer from a given string?Java Pig Latin sentence translator using Queueswhile + Scanner with System.in + hasNextMy program gives me java.lang.ArrayIndexOutOfBoundsException: 1Keep getting this error message for my RockPaperScissor Program. How do I fix this error?Best way to add an input enter part(scanf) into a java function returns arrayPig-English Translate Program Displaying Incorrectly



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am making a java program that translates a sentence to pig latin. I need to have at least one try-catch in this program and the translation must be done in a function. The original word will be passed to this function and return the translated word back to the function call per my professor's wishes. I am also having trouble asking the user if they want to translate something else. even when I say no it still restarts the program.



this is what I have:



package midtermPigLatin;
import java.util.Scanner;

import textio.TextIO;
public class midtermPigLatin
public static void main(String[] args)

Scanner input = new Scanner( System.in );
String yourSentence="";
boolean again = true;
try


do
String[] words;
System.out.print("Enter your words here: ");
yourSentence = input.nextLine();
words = yourSentence.split(" ");
for (String word : words)


System.out.println();
System.out.println("Do you want to play again, Yes or no");
again = TextIO.getBoolean();

while(!yourSentence.equals("quit"));



catch(Exception errMsg)

System.out.print(" error" + errMsg);







I just need help modifying my program to pass the translation through a function original word will be passed to this function and return the translated word back to the function call and the ending the program if user says no.



Here is what I get when I run the program:



Enter your words here: apple door shave
appleway oorday aveshay
Do you want to play again, Yes or no
no
Enter your words here:









share|improve this question




























    1















    I am making a java program that translates a sentence to pig latin. I need to have at least one try-catch in this program and the translation must be done in a function. The original word will be passed to this function and return the translated word back to the function call per my professor's wishes. I am also having trouble asking the user if they want to translate something else. even when I say no it still restarts the program.



    this is what I have:



    package midtermPigLatin;
    import java.util.Scanner;

    import textio.TextIO;
    public class midtermPigLatin
    public static void main(String[] args)

    Scanner input = new Scanner( System.in );
    String yourSentence="";
    boolean again = true;
    try


    do
    String[] words;
    System.out.print("Enter your words here: ");
    yourSentence = input.nextLine();
    words = yourSentence.split(" ");
    for (String word : words)


    System.out.println();
    System.out.println("Do you want to play again, Yes or no");
    again = TextIO.getBoolean();

    while(!yourSentence.equals("quit"));



    catch(Exception errMsg)

    System.out.print(" error" + errMsg);







    I just need help modifying my program to pass the translation through a function original word will be passed to this function and return the translated word back to the function call and the ending the program if user says no.



    Here is what I get when I run the program:



    Enter your words here: apple door shave
    appleway oorday aveshay
    Do you want to play again, Yes or no
    no
    Enter your words here:









    share|improve this question
























      1












      1








      1








      I am making a java program that translates a sentence to pig latin. I need to have at least one try-catch in this program and the translation must be done in a function. The original word will be passed to this function and return the translated word back to the function call per my professor's wishes. I am also having trouble asking the user if they want to translate something else. even when I say no it still restarts the program.



      this is what I have:



      package midtermPigLatin;
      import java.util.Scanner;

      import textio.TextIO;
      public class midtermPigLatin
      public static void main(String[] args)

      Scanner input = new Scanner( System.in );
      String yourSentence="";
      boolean again = true;
      try


      do
      String[] words;
      System.out.print("Enter your words here: ");
      yourSentence = input.nextLine();
      words = yourSentence.split(" ");
      for (String word : words)


      System.out.println();
      System.out.println("Do you want to play again, Yes or no");
      again = TextIO.getBoolean();

      while(!yourSentence.equals("quit"));



      catch(Exception errMsg)

      System.out.print(" error" + errMsg);







      I just need help modifying my program to pass the translation through a function original word will be passed to this function and return the translated word back to the function call and the ending the program if user says no.



      Here is what I get when I run the program:



      Enter your words here: apple door shave
      appleway oorday aveshay
      Do you want to play again, Yes or no
      no
      Enter your words here:









      share|improve this question














      I am making a java program that translates a sentence to pig latin. I need to have at least one try-catch in this program and the translation must be done in a function. The original word will be passed to this function and return the translated word back to the function call per my professor's wishes. I am also having trouble asking the user if they want to translate something else. even when I say no it still restarts the program.



      this is what I have:



      package midtermPigLatin;
      import java.util.Scanner;

      import textio.TextIO;
      public class midtermPigLatin
      public static void main(String[] args)

      Scanner input = new Scanner( System.in );
      String yourSentence="";
      boolean again = true;
      try


      do
      String[] words;
      System.out.print("Enter your words here: ");
      yourSentence = input.nextLine();
      words = yourSentence.split(" ");
      for (String word : words)


      System.out.println();
      System.out.println("Do you want to play again, Yes or no");
      again = TextIO.getBoolean();

      while(!yourSentence.equals("quit"));



      catch(Exception errMsg)

      System.out.print(" error" + errMsg);







      I just need help modifying my program to pass the translation through a function original word will be passed to this function and return the translated word back to the function call and the ending the program if user says no.



      Here is what I get when I run the program:



      Enter your words here: apple door shave
      appleway oorday aveshay
      Do you want to play again, Yes or no
      no
      Enter your words here:






      java function try-catch try-catch-finally






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 9 at 6:05









      Brittany GradfordBrittany Gradford

      94




      94






















          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074513%2fpig-latin-java-program-with-try-catch-translation-passed-though-function%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074513%2fpig-latin-java-program-with-try-catch-translation-passed-though-function%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

          Алба-Юлія

          Захаров Федір Захарович