title: How to set up a loop condition that ends when a particular string input is entered
body: <p>This is the input part of my problem.
  Write a program that will continuously allow the user to enter the following:</p>
  <p>*Temperature at 3 different instances</p>
  <p><em>Unit of Temperature for the 3 inputs (Celsius, Fahrenheit, Kelvin)</em></p>
  <p><em>Unit of Temperature for Conversion (Celsius, Fahrenheit, Kelvin)</em></p>
  <p><em>If none of these conditions are met or the output has been printed then it will return to ask the</em></p>
  <p><em>user to enter new values.</em></p>
  <p><em><strong>If at any point during the input stage the user enters the word &quot;Quit&quot; then end the program.</strong></em>*</p>
  <p>I was able to do everything in the problem but I skipped the last condition above since I don't know how to set it up.
  Now this is the input phase of my program:</p>
  <pre><code>Scanner sc = new Scanner(System.in);
   
          System.out.println(&quot;Please give three numbers&quot;);
          int num1 = sc.nextInt();
          int num2 = sc.nextInt();
          int num3 = sc.nextInt();
          System.out.println(&quot;Choose the temperature unit of the three numbers.&quot;);
          System.out.println(&quot;Enter 1 for Celsius, 2 for Fahrenheit and 3 for Kelvin&quot;);
          int tempUnit = sc.nextInt();
          switch (tempUnit) {
              case (1) -&gt; System.out.println(&quot;Celsius was chosen.&quot;);
              case (2) -&gt; System.out.println(&quot;Fahrenheit was chosen.&quot;);
              case (3) -&gt; System.out.println(&quot;Kelvin was chosen.&quot;);
          }
          System.out.println(&quot;Choose the temperature unit you want to convert it into.&quot;);
          System.out.println(&quot;Enter 1 for Celsius, 2 for Fahrenheit and 3 for Kelvin&quot;);
          int chosenTemp = sc.nextInt();
              switch (chosenTemp) {
                  case (1) -&gt; System.out.println(&quot;Celsius was chosen.&quot;);
                  case (2) -&gt; System.out.println(&quot;Fahrenheit was chosen.&quot;);
                  case (3) -&gt; System.out.println(&quot;Kelvin was chosen.&quot;);
              }
  </code></pre>
  <p>The condition that as long as the string &quot;Quit&quot; is input at any point the loop ends program ends.</p>
  <p>A while loop on top with the condition that checks if the input &quot;Quit&quot; is entered will complete</p>
  <p>everything but I keep failing most of the time because I get an error if a different data type is</p>
  <p>inputted than what is being asked.</p>
  <p>Someone told me my prompt isn't set up for this to receive &quot;Quit&quot; for my while loop. Can anybody</p>
  <p>give me an example or teach me how I set this up?</p>