Draw a Star Grid

From Progzoo

You can tackle this problem using methods. Ideally you would have a method starGrid(g,x,y) that will draw a grid of x stars along and y stars deep. If such a method was available then your program could read:

 g.translate(8,7);
 starGrid(g,6,5);
 g.translate(8,7);
 starGrid(g,5,4);

The method starGrid is relatively simple to write

Size: 246 by 130. Thirteen red and white stripes. A 5x4 grid of 20 stars interleaved with a 6x5 grid of 30 stars on a blue background.

  • Radius of star: 5
  • Horizontal grid offset: 8
  • Vertical grid offset: 7

Model answer has 39 lines.


Hints:

  • Draw a Star Grid
[Font] [Default] [Show] [Resize] [History] [Profile]