Public Group

# Computer Science Java School question

This topic is 4443 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hullo, I am in a computer science class at my High School and we are using Java as the language. So far we've made applets and applications using data types, and basic graphics like drawLine, fillRect, drawRect, drawOval, etc. Just recently we've begun loops, and this is a lab we're going to be working on. Problem is, I've been messing around and cannot achieve that result. The paper said it is composed of merely straight lines, but it doesn't look like it, and obviously doesn't have an even scale.

##### Share on other sites
Here's what seems to be happening:

Take your first line. Draw it from the bottom left hand corner to the low right. Your next line starts a little to the right (but still on the bottom) of that corner and goes a little higher (but still to the far right). Your next line is a little more right and a little higher. Until eventually your final line is drawn almost at the very right hand corner and all the way to the top.

In psuedocode, it might look something like this:

startX = 0, startY = windowY, endX = windowX, endY = windowY - 10;
for (i = 1 to 50)
{
drawLine(startX, startY, endX, endY)
startX += 10
endY -= 10
}

Hope that helps,
--Brian

1. 1
Rutin
31
2. 2
3. 3
4. 4
5. 5

• 12
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633314
• Total Posts
3011323
• ### Who's Online (See full list)

There are no registered users currently online

×