Assessment 2009 Easy Answers

From Progzoo
Jump to: navigation, search

Flags of regions of Italy and Spain

Aosta Valley

Flag of Aosta Valley
  • Black and Red
  • 200 by 133


[Font] [Default] [Show] [Resize] [History] [Profile]

Catalonia

Flag of Catalonia
  • red(218,18,26) and yellow (252,221,9)
  • 200 by 135
  • 9 horizontal stripes


[Font] [Default] [Show] [Resize] [History] [Profile]

Basque

Flag of Basque Autonymous Community
  • 200 by 112
  • line width is 17
  • red is 220,36,31
  • green is 0, 149, 67

You can use setStroke and drawLine' to draw the lines. For example the following code draws a line of thickness 20.

 g.setStroke(new BasicStroke(20));
 g.drawLine(0,0,100,66)


[Font] [Default] [Show] [Resize] [History] [Profile]

Madrid

Flag of Madrid
  • 200 by 128
  • radius of each star is 16
  • the first star is at 45,52
  • the second star is at 63,77
  • red is 198,11,30

You may use the method fillStar which can be used many times. The method may defined either before or after the drawFlag method.

static void fillStar(Graphics2D g, int x, int y){
  Polygon star = new Polygon(
   new int[]{0,22,95,36,59,0,-59,-36,-95,-22},
   new int[]{-100,-31,-31,12,81,38,81,12,-31,-31},10);
  g.translate(x,y);
  g.scale(16/100.0,16/100.0);
  g.fillPolygon(star);
  g.scale(100.0/16,100.0/16);
  g.translate(-x,-y);
}

You can call the method from within the drawFlag method.

  fillStar(g,45,52);


[Font] [Default] [Show] [Resize] [History] [Profile]

Piemonte

Flag of Piemonte
  • 200 by 134
  • the border is 8 color 12,60,124
  • the white cross has width 28
  • red is 198,11,30

The blue shape above the centre of the cross can be drawn using the following polygon. g.fillPolygon(p) will show the shape in the current colour.

 Polygon p = new Polygon(
   new int[]{60,139,145,129,134,104,109,91,96,64,70,54},
   new int[]{18, 18, 33, 33, 23, 23, 33,33,23,23,33,33},
   12);


[Font] [Default] [Show] [Resize] [History] [Profile]