Results 1 to 2 of 2
- 09-12-2009, 10:54 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 1
- Rep Power
- 0
Help with ASCII Drawing--For loops--if/else
Hello,
I need help with coding of the following object [Link]:
[i252.photobucket.com/albums/hh8/eretronics/parking_lot.jpg]
This is what I've tried so far, I think I have made a lot of boo-boos, needs serious editing...
// linc_size is a constant that determines the length of the drawing
int linc_size = 4;
for (int i = 1; i <= linc_size * linc_size; i++)
{
for (int j = 1; j <= (linc_size * 2 * 3 * 4); j++)
{
if (j <= j + linc_size * 2)
System.out.println("");
else if ((j == 1 + linc_size * 2 + 1) ||
(j == 1 + linc_size * 2 * 2 + 1 + 1) ||
(j == 1 + linc_size * 2 * 2 + 1 + 1 + 1))
System.out.println(" ");
else if ((j == 1 + linc_size * 2 + 1 + 1) ||
(j == 1 + linc_size * 2 * 2 + 1 + 1 + 1) ||
(j == 1 + linc_size * 2 * 2 + 1 + 1 + 1 + 1))
System.out.println("|");
else
System.out.println("_");
}
System.out.println();
}
- 09-13-2009, 01:31 AM #2
The code above is a mess, use code tags.
Having said that, here's the pseudo code:
Java Code:printFirstLine(); LOOP: printCell(); printCell(); printNewLine(); that should produce: _______________ // first line |_______|_______| // 2 cells and NL |_______|_______| // loop |_______|_______| // loop |_______|_______| // loop
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
Similar Threads
-
Getting ascii from a String
By ali_sakar in forum New To JavaReplies: 1Last Post: 03-07-2009, 11:11 AM -
Another ascii question....
By akira220984 in forum New To JavaReplies: 5Last Post: 02-20-2009, 02:38 AM -
I need help with ascii characters
By Grandon in forum EclipseReplies: 17Last Post: 11-08-2008, 03:12 AM -
Ascii code.........
By Somitesh Chakraborty in forum New To JavaReplies: 6Last Post: 11-04-2008, 06:32 PM -
Loops (while do etc)
By manupr in forum New To JavaReplies: 1Last Post: 01-15-2008, 04:59 AM
Bookmarks