Question: Can someone pls help me correct my solutions using java? I think I am on the right path but I need a little help. Thanks

Can someone pls help me correct my solutions using java? I think I am on the right path but I need a little help. Thanks

public class Main { public static void main(String[] args) { straightline(); UpTriangle(); downTriangle(); straightLine(); } public static void straightLine(){ for (int i = 1; iout.print("+"); for (int j = 0; j out.print("-"); } System.out.println("+"); } } public static void UpTriangle(){ for(int line = 1; line out.print("|"); for(int space = 1; space out.print(" "); } System.out.print("*"); for (int space = 1; space out.print(" "); } System.out.println("|"); } } public static void downTriangle(){ for(int line = 1; line out.print("|"); for(int space = 1; space out.print(" "); } System.out.print("*"); for (int space = 1; space out.print(" "); } System.out.println("|"); } } public static void straightline(){ for (int i = 1; iout.print("+"); for (int j = 0; j out.print("-"); } System.out.println("+"); } } }

Can someone pls help me correct my solutions using java? I think

Q2: Write a Program to draw a different shapes using static methods and for loops. Use a constant integer to specify the number of rows of the shape. Change the value of the constant to scale the shape to a different number of rows. The main method must only have different calls of the following three methods. 1- a method called straightLine() to draw the following line: 2- a second method called UpTriangle() to draw the following shape if you set the number of rows to four: 1 | 11/11 3-a third method called down Triangle() to draw the following shape if you set the number of rows to four: 11*7711 | \*// | 11*71 1 1 If you set the number of rows to four, the program should draw the following shape: 1 | 1171 | 1/1 1 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!