Print Grid in Java

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Xaos
Posts: 946
Joined: Wed Jan 11, 2012 4:01 am

Print Grid in Java

Post by Xaos »

Hey guys, sorry I haven't been posting as much. Been super busy with life and school :D

I am doing a project for my Software Development class and I'm having an issue. I'm trying to print a grid in Java using a 2D array. I know the length of the rows and the length of the columns. Everything works fine, except I need to have the borders of the grid print *. It all works okay, the top and bottom and the left work fine. However, the right side of the grid is basically cut in half.

**********
* *
* *
* *
* *
***********

So it basically looks like that. The part that should be in the right column appears directly in the center of the grid, rather than on the right side. I'm basically using two for loops, checking if the first for loop variable equals 0 and the max row, and that is the top and bottom. Then I'm checking if the second checks as 0 or the max column, and that's the left and right columns. I'm not allowed to post specific code but I can questions like this. Any of you guys got any ideas to what is causing this/anything that can point me towards the right direction?
User avatar
Chris
Posts: 1580
Joined: Wed Sep 30, 2009 7:22 pm

Re: Print Grid in Java

Post by Chris »

Can't help without code.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
hallsofvallhalla
Site Admin
Posts: 12031
Joined: Wed Apr 22, 2009 11:29 pm

Re: Print Grid in Java

Post by hallsofvallhalla »

yup need some code to see what is going on.
Post Reply

Return to “Coding”