Question: import java.util.Scanner; public class DrawHalfArrow { public static void main ( String[] args ) { Scanner scnr = new Scanner(System. in ); int arrowBaseHeight =
import java.util.Scanner; public class DrawHalfArrow { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int arrowBaseHeight = 0; int arrowBaseWidth = 0; int arrowHeadWidth = 0; System.out.println("Enter arrow base height: "); arrowBaseHeight = scnr.nextInt(); System.out.println("Enter arrow base width: "); arrowBaseWidth = scnr.nextInt(); System.out.println("Enter arrow head width: "); arrowHeadWidth = scnr.nextInt(); while (arrowHeadWidth<=arrowBaseWidth) { System.out.println("arrow head width is not larger than arrow base width"); System.out.println("Enter arrow head width:"); arrowHeadWidth = scnr.nextInt(); } System.out.println(); StringBuilder row = new StringBuilder(); for (int x = 1; x <= arrowBaseWidth; x++) { row.append("*"); } for (int i = 1; i <= arrowBaseHeight; i++) { System.out.println(row); } int tmp = arrowHeadWidth; for (int y = 1; y <= arrowHeadWidth; y++) { for (int z = tmp; z > 0; z--) { System.out.print("*"); } tmp -= 1; System.out.println(); } } }
Here is my problem has a enter line that I do not need
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
