I am trying to create a java program that will accept inputs from the user to draw a single star (*) rectangle within the grid. I want the program to accept the (x, y) coordinate pair of the top left corner of the rectangle, along with the rectangle’s width and height. It should then draw the rectangle like this Ex. (x = 16, y = 14) and (width = 4, height = 5). I'm struggling with where to approach this as I am trying to do it without using arrays or 2d arrays for drawing the rectangle and cartesian grid.
How would I go about dividing up the cohesive methods I need to draw a 20x40 grid, and then draw a shape onto that grid without messing up the grid by drawing it?
Any tips/code to get my gears turning would be appreciated.
(no experience with special libraries either, so this has to be pretty vanilla java)
Y
^
20 +
|
|
|
|
15 +
| ****
| ****
| ****
| ****
10 + ****
|
|
|
|
5 +
|
|
|
|
0 +====+====+====+====+====+====+====+====+ >X
0 5 10 15 20 25 30 35 40