Home /
Expert Answers /
Computer Science /
in-c-5-24-lab-program-drawing-a-half-arrow-this-program-outputs-a-downwards-facing-arrow-comp-pa327
(Solved): IN C++
5.24 LAB*: Program: Drawing a half arrow This program outputs a downwards facing arrow comp ...
IN C++
5.24 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 arrow Base Height (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 t'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 arrowBase Height = 5, arrowBaseWidth = 2, and arrow Headwidth = 4 Enter arrow base height: 5 Enter arrow base width: 2 Enter arrow head width: 4 *********
LAB ACTIVITY 5.24.1: LAB*: Program: Drawing a half arrow 0/5 main.cpp Load default template. 1 #include 2 using namespace std; 3 4 int main() { 5 int arrowBaseHeight; 6 int arrowBaseWidth; 7 int arrowHeadwidth; 8 8 9 cout << "Enter arrow base height:" << endl; 10 cin >> arrowBaseHeight; 11 12 cout << "Enter arrow base width:" << endl; 13 cin >> arrowBaseWidth; 14 15 cout << "Enter arrow head width:" << endl; 16 cin >> arrowheadwidth; 17 cout << endl; 18 19 // Draw arrow base (height = 3, width = 2) 2 20 cout << "**" << endl; 21 cout << ***" << endl; 22 cout << "**" << endl; 23 24 // Draw arrow head (width = 4) 25 cout << "****" << endl; 26 cout << ? ***" << endl; cout << << endl; 28 cout << " << endl; 29 30 return; 31 27
???????????????? ???????? ???????????? ???????????????? ???????????? ????????????: import java.util.Scanner; public class DrawHalfArrow { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int arrowBaseHeight; in