#sizing problem
1 messages · Page 1 of 1 (latest)
heres the code
import java.util.Scanner;
public class AssignedAsciiArt {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.print("What size space needle would you like to see? ");
int size = in.nextInt();
point(size);
body(size);
}
public static void point(int size){
for(int i = 1;i<=size;i++){
for(int u=1;u<=size+8;u++){
System.out.print(" ");
}
System.out.println("||");
}
for(int n = 1;n <= size;n++){
int spaceloop =(n*-3)+12;
for (int space = 1; space <= spaceloop; space++) {
System.out.print(" ");
}
System.out.print("__/");
if(n==1){
System.out.print("||");
}
for(int y = 1; y<=2;y++){
if(n>1){
if(y==2){
System.out.print("||");
}
for(int t = 1;t<=n-1;t++){
System.out.print(":::");
}
}
}
System.out.print("\\__\n");
}
}
public static void body(int size){
for(int i = 1;i<=size;i++){
for(int u=1;u<=size+8;u++){
System.out.print(" ");
}
System.out.println("||");
}
for(int p = 1;p<=size*size;p++){
for(int j=1;j<=2;j++){
if(j==1){
System.out.print(" |");
}
if(j==2){
System.out.print("||");
}
for(int q = 1;q<=size-2;q++){
System.out.print("%");
}
if(j==2){
System.out.println("|");
}
}
}
}
}
- What does it do?
- What should it do?
Well yes, but what are you actually expecting, provide the expected versus actual output.
I have no idea what the space needle is supposed to look like. Or what an ASCII-art representation should look like.
something like this
And what's your output?
well for this given input of 4 its the same but anything over that looks something like this. this is the top by the way
I'd recommend debugging your flow, you have some hardcoded numbers which should instead be based upon your input.
It looks like you can define it in sections - then count out where the middle should be and solve each one independently - that at least will let you focus on one pattern at a time.
Each pattern will have a formula to apply and you should be able to work through it from there (or come back to us with the one you're still struggling with)