9.14 LAB: Drawing a right side up triangle Write a recursive method called draw Triangle() that outputs lines of '*' to

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

9.14 LAB: Drawing a right side up triangle Write a recursive method called draw Triangle() that outputs lines of '*' to

Post by answerhappygod »

9 14 Lab Drawing A Right Side Up Triangle Write A Recursive Method Called Draw Triangle That Outputs Lines Of To 1
9 14 Lab Drawing A Right Side Up Triangle Write A Recursive Method Called Draw Triangle That Outputs Lines Of To 1 (108.67 KiB) Viewed 50 times
9.14 LAB: Drawing a right side up triangle Write a recursive method called draw Triangle() that outputs lines of '*' to form a right side up isosceles triangle. Method draw Triangle() has one parameter, an integer representing the base length of the triangle. Assume the base length is always odd and less than 20. Output 9 spaces before the first on the first line for correct formatting. Hint: The number of '*' increases by 2 for every line drawn. Ex: If the input of the program is: 3 the method draw Triangle() outputs: Ex: If the input of the program is: 19 the method draw Triangle() outputs: Note: No space is output before the first '*' on the last line when the base length is 19. 405526.2665202.qx3zqy7 LAB ACTIVITY 9.14.1: LAB: Drawing a right side up triangle 14 15 3 1 import java.util.Scanner; 2 3 public class LabProgram { /* TODO: Write recursive drawTriangle() method here. */ LabProgram.java public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int baseLength; } baseLength = scnr.nextInt(); drawTriangle(baseLength); 0/10 Load default template...
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply