time++;
if (height<0) //simulates the bounce
{
height=height*-.5;
vel=vel*-.5;
System.out.println("Time:"+time+" Height:"+height);
bounce++;
}
else // during time in the air
System.out.println("Time:"+time+" Height:"+height);

}

}
}

this is a simple loop for a bounceing ball. What i need to do is to get a certain number of "*" to appear next to my height number. The number of "*" is dependent to height that is generated. For the life of me i can not figure this out. in other words i need a way to multiply "*" by the height. Any help would be great. Just need to be pointed in the right direction. Thanks
(p.s. very very new to the whole progamimg thing)

03-19-2011, 10:55 PM

Fubarable

Welcome to the forum. I suggest that you calculate your number, then use a loop to write out the "*" character based on this number. Since you'll know before the loop how many times you'll want the loop to occur, a for loop would work best. Since you want to print the "*" without carriage returns, you'll want to use System.out.print(...) inside the loop, and System.out.println() just after the for loop.

I edited your code and added code tags which should help make your posted code retain its formatting and be more readable.

To do this yourself, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

Another way to do this is to manually place the tags into your code by placing the tag [cod&#101;] above your pasted code and the tag [/cod&#101;] below your pasted code like so:

Code:

[cod&#101;]
// your code goes here
// notice how the top and bottom tags are different
[/cod&#101;]