title: Drawing a half arrow using loops in Java
body: <p>I'm trying to draw a half arrow in Java and continuously get the same error upon running the code. I'm not sure what I am doing wrong and any assistance would be great.</p>
  <p>Instructions: This program outputs a downwards facing arrow composed of a rectangle and a right triangle. The arrow dimensions are defined by user specified arrow base height, arrow base width, and arrow head width.</p>
  <p>(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)</p>
  <p>(2) Modify the given program to use a loop to output an arrow base of width arrowBaseWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow base. (1 pt)</p>
  <p>(3) Modify the given program to use a loop to output an arrow head of width arrowHeadWidth. Use a nested loop in which the inner loop draws the *’s, and the outer loop iterates a number of times equal to the height of the arrow head. (2 pts)</p>
  <p>(4) Modify the given program to only accept an arrow head width that is larger than the arrow base width. Use a loop to continue prompting the user for an arrow head width until the value is larger than the arrow base width. (1 pt)</p>
  <p>Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:</p>
  <p>Enter arrow base height: 5
  Enter arrow base width: 2
  Enter arrow head width: 4
  **
  **
  **
  **
  **</p>
  <hr />
  <hr />
  <p>**
  *
  My code:</p>
  <pre><code>import java.util.Scanner;
  
  public class DrawHalfArrow {
      public static void main(String[] args) {
          Scanner scnr = new Scanner(System.in);
          int arrowBaseHeight;
          int arrowBaseWidth;
          int arrowHeadWidth;
  
          System.out.print(&quot;Enter arrow base height: &quot;);
          arrowBaseHeight = scnr.nextInt();
  
          System.out.print(&quot;Enter arrow base width: &quot;);
          arrowBaseWidth = scnr.nextInt();
  
          System.out.print(&quot;Enter arrow head width: &quot;);
          arrowHeadWidth = scnr.nextInt();
          while (arrowHeadWidth &lt;= arrowBaseWidth) {
              System.out.print(&quot;Enter arrow head width: &quot;);
              arrowHeadWidth = scnr.nextInt();
          }
  
          System.out.println();
          for (int i = 0; i &lt; arrowBaseHeight; i++) {
              for (int j = 0; j &lt; arrowBaseWidth; j++) {
                  System.out.print(&quot;*&quot;);
              }
              System.out.println();
          }
  
          for (int i = arrowHeadWidth; i &gt; 0; i--) {
              for (int j = 0; j &lt; i; j++) {
                  System.out.print(&quot;*&quot;);
          }
          System.out.println();
      }
  }
  </code></pre>
  <p>}</p>