I saw a question on "YAHOO ANSWERS" and and here is my solution .I just want to get some suggestions to improve my code .Or if I have used some bad programming practices to get to know about them.but I dont know is it ok to post this kind of questions where actually Im not asking a specific question .So My friends if this is post is not suitable please tell me.I won't post this kind of questions again .Im learning java through self studies these days so finding a way to improve my coding abilities.
Question was ---
How to do this java programme?
Q3. Write a program to draw a diamond sign in to the screen with different heights entered by the user. See following example.
Hey Ankit you were dead right !!! actually what had happened was the yahoo page i visited showed the exact output i was trying to get.So as a stupid i didn't read the whole problem,and started coding for the output i saw.(may be an error in loading of that yahoo page )
And after your correction i tried to get that output and here is my code .but there is a error in the shape .I cant point out the error .Please help me on this !!!
* Are you aware that you are only using your static variables height
and state in your main method? I'd suggest to have those variables
be local variables in your main method then.
* Add more comments to your code to make it easier to read what, for example,
the goals of your for-loops are. I (and you after X months) have to completely
figure it out myself. Something like:
* After you've done that, you'll quickly find out that you should not have put your
for-loop for variable k (denoted A above) within your for-loop of variable j (denoted B above).