Create a console program where you will implement coding con
Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.
The program should use StringBuilder and any loop construct that will work to output the string \"Bark \" and \"Meow \" ten (10) times with growing columns (1 to 10) as shown below.
The odd columns will display \"Bark \" and the even columns will display \"Meow \".
Each row will be built using StringBuilder.
You should format your output to look exactly like the following:
Bark
 Bark Meow
 Bark Meow Bark
 Bark Meow Bark Meow
 Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow
 Bark Meow Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow Bark Meow
 Bark Meow Bark Meow Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow Bark Meow Bark Meow
 Press any key to continue . . .
Solution
StringBuilderTest.java
 public class StringBuilderTest {
  
    public static void main(String[] args) {
        StringBuilder sb = new StringBuilder();
        for(int i=1; i<=10; i++){
            for(int j=1; j<=i; j++){
            if(j%2!=0){
                sb.append(\"Bark \");
            }
            else{
                sb.append(\"Meow \");
            }
            }
            sb.append(\"\ \");
        }
        System.out.println(sb.toString());
    }
}
Output:
Bark
 Bark Meow
 Bark Meow Bark
 Bark Meow Bark Meow
 Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow
 Bark Meow Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow Bark Meow
 Bark Meow Bark Meow Bark Meow Bark Meow Bark
 Bark Meow Bark Meow Bark Meow Bark Meow Bark Meow


