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.
Please try to solve this part, I already have a headache.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started