English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a java program that must construct a diamond. A user enters the number of lines and a symbol to be used. For example a it must look like two pyramids stuck together, one stacked on another that is flipped, with the right amount of spaces. I have constructed it so that it almost works, except I can't get the spacing to work for the bottom pyramid.

The java file is at
http://www.angusb.be/media/Diamond.java

The file works except for the spacing. PLEASE HELP!!! THanks so MUCH!

any questions - angusb AT gmail.com

2006-11-28 12:16:10 · 3 answers · asked by Angus B 1 in Computers & Internet Programming & Design

3 answers

Look at your second loop (while (LineNumber > 0))...

You're drawing the symbols and *then* you're drawing the spaces.

Reverse the order you do those two things. Draw the spaces first. :)

2006-11-29 17:01:38 · answer #1 · answered by watsonc64 3 · 0 0

I'll look at it, hold on I'll post my answer in a few compiling and running source to see the problem. (I do suspect it has to do with your algorithms more than with actual programming)

look up the math formula or coordinates for a diamond.

2006-11-28 13:08:29 · answer #2 · answered by R2_ 2 · 0 0

If your computer is not working properly while you are working on it, it could be a problem with device drivers, hardware or software.
Detailed instructions at http://tinyurl.com/yk5zpr

2006-11-29 03:19:33 · answer #3 · answered by Anonymous · 0 1

fedest.com, questions and answers