Question: Create a Java program that produces an art representation below, note that int size can be any number from 2 to infinite , I've attempted

Create a Java program that produces an art representation below, note that int size can be any number from 2 to infinite, I've attempted to work on this problem but the pattern is the toughest part, please avoid if and else statements.

int size = 2

.../=-=-=-=-=-=-=-=\... /=-=-=-=-=-=-=-=-=-=-=\

int size = 3

.../=-=-=-=-=-=-=-=-=-=-=-=-=\... /=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\

int size = 4

....../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\...... .../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\... /=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\

int size = 5

....../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\...... .../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\... /=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\

int size = 6

........./=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\......... ....../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\...... .../=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\... /=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\

Here's the code I've worked on for this part, please try to fix it, thank you:

public static int size = 4;

public static void equalLine(){ for (int equalRows =1; equalRows <= (size/2)+1; equalRows++){ System.out.print(""); for (int dotLine = 0; dotLine < (size/2)- (equalRows-1); dotLine++){ System.out.print("..."); } System.out.print("/"); for (int equal = 0; equal < (size*5)-(((size-equalRows)-1)*3); equal++){ System.out.print("=-"); } System.out.print("=\\"); for (int dotLine = 1; dotLine <= (size/2)- (equalRows-1); dotLine++){ System.out.print("..."); } System.out.print(" "); } }

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!