3.35 LAB*: Program: Drawing a half arrow 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. (1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt) (2) Modify the given program to use a loop to output an arrow base of width arrow BaseWidth. 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) (3) Modify the given program to use a loop to output an arrow head of width arrow HeadWidth. 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) (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) while (arrowHeadWidth <= arrowBaseWidth) ( // Prompt user for a valid arrow head value ) Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4: Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4 426212.1992070.qx3zqy7 LAB ACTIVITY 7 1 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; 8 9 10 11 12 13 3.35.1: LAB*: Program: Drawing a half arrow 14 1C DrawHalfArrow.java System.out.println("Enter arrow base height: "); arrowBaseHeight scnr.nextInt(); System.out.println("Enter arrow base width: "); arrowBaseWidth scnr.nextInt(); 0/5 Load default template...
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.
(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)
(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)
(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)
(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)
while (arrowHeadWidth <= arrowBaseWidth) {
// Prompt user for a valid arrow head value
}
Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:
Enter arrow base height:
5
Enter arrow base width:
2
Enter arrow head width:
4
**
**
**
**
**
****
***
**
*
![3.35 LAB*: Program: Drawing a half arrow
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.
(1) Modify the given program to use a loop to output an arrow base of height arrowBaseHeight. (1 pt)
(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)
(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)
(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)
while (arrowHeadWidth <= arrowBaseWidth) {
// Prompt user for a valid arrow head value
}
Example output for arrowBaseHeight = 5, arrowBaseWidth = 2, and arrowHeadWidth = 4:
Enter arrow base height:
5
Enter arrow base width:
2
Enter arrow head width:
4
tak
***
**
426212.1992070.qx3zqy7
LAB
ACTIVITY
1 import java.util.Scanner;
2
7
8
9
3.35.1: LAB*: Program: Drawing a half arrow
3 public class DrawHalfArrow {
4 public static void main(String[] args) {
5
new Scanner(System.in);
6
10
11
12
13
14
15
DrawHalfArrow.java
Scanner scnr
int arrowBaseHeight;
int arrowBaseWidth;
int arrowHeadWidth;
System.out.println("Enter arrow base height: ");
arrowBaseHeight scnr.nextInt();
System.out.println("Enter arrow base width: ");
arrowBaseWidth scnr.nextInt ();
0/5
Load default template....](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F0fb6fbe8-c93b-4e2e-8100-eedf21471e21%2F4548c504-8a65-4334-bab7-3cf43acc6639%2Fkhfsf1a_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images









