I am having difficulty finding a suitable solution to stop the recurrence of blanks after the stars have finished printing, and this caused me a problem in printing Yemeni lines diverging, so I want them to be straight and similar to this pattern
public class task {
public static void pettren1(int high, int width) {
high = 11;
width = 14;
//Overline
for (int i = 0; i <= width /2; i++) {
System.out.print(" _");
}
System.out.println();
for (int i = high; i > 0; i--) {
//The left line and the space
System.out.print("|");
for (int j = high-1; j >= i; j--)
System.out.print(" ");
//for the stars
for (int k = 1; k <= (i * 2 - 7); k++)
System.out.print("*");
//The right line and the space
for (int j = high-1; j >= i; j--)
System.out.print(" ");
System.out.print("|");
System.out.println();
}
//The bottom line
for (int i = 0; i <= width /2; i++) {
System.out.print(" _");
}
}
public static void main(String[] args) {
pettren1(0, 0);
}
}
my output