Difference between revisions of "Assessment 2012 Easy"

From Progzoo
Jump to: navigation, search
(Naval Jack)
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{Assessment 2012}}
 
{{Assessment 2012}}
 
<shell lang="java" className="Flag" import="shells.xml#raster"/>
 
<shell lang="java" className="Flag" import="shells.xml#raster"/>
Each of these flags is worth 9 points.  
+
Each of these flags is worth 9 points.
 +
==Teresina==
 +
<question width="284" height="208" imgOut="flag.png" className="Raster" title="Teresina" cols="60">
 +
*284 by 208
 +
*Blue is RBG 8 41 140
 +
*Green is RGB 16 148 82
 +
*Yellow is RGB 255 239 8
 +
*The star has radius 32
 +
[[Image:Flags of Brazil Teresina.png|frame|Teresina]]
 +
<prog lang="java"><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setColor(new Color(8,41,140));
 +
  drawStar(g,100,100,36);
 +
}
 +
static void drawStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}]]>
 +
</prog>
 +
<answer><![CDATA[
 +
static void drawFlag(Graphics2D g){
 +
  g.setRenderingHint(
 +
    RenderingHints.KEY_ANTIALIASING,
 +
    RenderingHints.VALUE_ANTIALIAS_ON);
 +
  Polygon p = new Polygon();
 +
  for (int i=0;i<13;i++){
 +
    if (i%2==0)
 +
      g.setColor(new Color(16,148,82));
 +
    else
 +
      g.setColor(new Color(255,239,8));
 +
    g.fillRect(0,i*16,284,i*16+16);
 +
  }
 +
  g.setColor(new Color(8,41,140));
 +
  g.fillRect(0,0,16*5,16*5);
 +
  g.setColor(Color.white);
 +
  fillStar(g,8*5,8*5,32);
 +
}
 +
static void fillStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}
 +
]]></answer>
 +
</question>
 +
 
 +
==Sergipe==
 +
<question width="300" height="200" imgOut="flag.png" className="Raster" title="Naval Jack" cols="60">
 +
*300 by 200
 +
*Blue is RBG 8 41 140
 +
*Green is RGB 16 148 82
 +
*Yellow is RGB 255 239 8
 +
*The stars have radius 26 and 13
 +
*The centre of the small star is 20 from the edge
 +
[[Image:Flags of Brazil Sergipe.png|frame|Sergipe]]
 +
<prog lang="java"><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setColor(new Color(8,41,140));
 +
  drawStar(g,100,100,36);
 +
}
 +
static void drawStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}]]>
 +
</prog>
 +
<answer><![CDATA[
 +
]]></answer>
 +
</question>
 +
 
 +
==Maranhão==
 +
<question width="300" height="207" imgOut="flag.png" className="Raster" title="Maranhão" cols="60">
 +
*300 by 207
 +
*Blue is RBG 0 41 140
 +
*Red is RGB 222 16 24
 +
*The star has radius 40
 +
[[Image:Flags of Brazil Maranhão.png|frame|Maranhão]]
 +
<prog lang="java"><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setColor(new Color(8,41,140));
 +
  fillStar(g,100,100,36);
 +
}
 +
 
 +
static void fillStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}
 +
]]>
 +
</prog>
 +
<answer><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setRenderingHint(
 +
    RenderingHints.KEY_ANTIALIASING,
 +
    RenderingHints.VALUE_ANTIALIAS_ON);  g.setColor(Color.white);
 +
  g.fillRect(0,0,300,207);
 +
  for(int i=0;i<5;i++){
 +
    g.setColor((i%2==0)?new Color(222,16,24)
 +
                      :Color.black);
 +
    g.fillRect(0,2*i*207/9,300,207/9);
 +
  }
 +
  g.setColor(new Color(8,41,140));
 +
  g.fillRect(0,0,207/2,207/2);
 +
  g.setColor(Color.white);
 +
  fillStar(g,207/4,207/4,40);
 +
}
 +
 
 +
static void fillStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}
 +
]]></answer>
 +
</question>
 +
 
 +
==Mato Grosso==
 +
<question width="300" height="200" imgOut="flag.png" className="Raster" title="Mato Grosso" cols="60">
 +
*300 by 200
 +
*Blue is RBG 40 22 111
 +
*Yellow is RGB 248 195 0
 +
*Green is RGB 0 146 63
 +
*The star has radius 50
 +
*Each point of the rhombus is 25 from the border
 +
[[Image:Flags of Brazil Mato Grosso.png|frame|Mato Grosso]]
 +
<prog lang="java"><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setColor(new Color(8,41,140));
 +
  fillStar(g,100,100,36);
 +
}
 +
 
 +
static void fillStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}
 +
]]>
 +
</prog>
 +
<answer><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setRenderingHint(
 +
    RenderingHints.KEY_ANTIALIASING,
 +
    RenderingHints.VALUE_ANTIALIAS_ON);
 +
  g.setColor(new Color(40,22,111));
 +
  g.fillRect(0,0,300,200);
 +
  int w = 300; int h=200; int gp = 25;
 +
  int sr = 50;
 +
  Polygon r = new Polygon(
 +
    new int[]{gp,w/2,w-gp,w/2},
 +
    new int[]{h/2,gp,h/2,h-gp},
 +
    4);
 +
  g.setColor(Color.white);
 +
  g.fillPolygon(r);
 +
  g.setColor(new Color(0,146,63));
 +
  g.fillOval(w/2-sr,h/2-sr,sr+sr,sr+sr);
 +
  g.setColor(new Color(248,195,0));
 +
  fillStar(g,w/2,h/2,sr);
 +
}
 +
 
 +
static void fillStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}
 +
]]></answer>
 +
</question>
 +
 
 
==Naval Jack==
 
==Naval Jack==
<question height="300" width="400" imgOut="flag.png" className="Raster" title="Naval Jack" cols="60">
+
<question width="342" height="255" imgOut="flag.png" className="Raster" title="Naval Jack" cols="60">
*342 by 170
+
*340 by 255
 
*The blue RBG 0,41,140
 
*The blue RBG 0,41,140
*The stars have radius 6
+
*The stars have radius 7
[[Image:roaddiversionsquare.png|frame|Diversion]]
+
[[Image:Flags of Brazil Naval Jack.png|frame|Naval Jack]]
<prog lang="java">
+
<prog lang="java"><![CDATA[static void drawFlag(Graphics2D g){
static void drawFlag(Graphics2D g){
+
  g.setColor(new Color(0,41,140));
 +
  for (int i=0;i<7;i++)
 +
    drawStar(g,170+26*i,127,12);
 +
}
 +
static void drawStar(Graphics2D g,int x, int y, int r)
 +
{
 +
  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(r/100.0,r/100.0);
 +
  g.fillPolygon(star);
 +
  g.scale(100.0/r,100.0/r);
 +
  g.translate(-x,-y);
 +
}]]>
 +
</prog>
 +
<answer><![CDATA[static void drawFlag(Graphics2D g){
 +
  g.setRenderingHint(
 +
    RenderingHints.KEY_ANTIALIASING,
 +
    RenderingHints.VALUE_ANTIALIAS_ON);
 
   g.setColor(new Color(0,41,140));
 
   g.setColor(new Color(0,41,140));
   drawStar(g,321,135,24);
+
   g.fillRect(0,0,340,255);
 +
  g.translate(340/2,255/2);
 +
  g.setColor(Color.white);
 +
  for (int i=-6;i<7;i++)
 +
    drawStar(g,26*i,0,7);
 +
  for (int i=-4;i<5;i++)
 +
    drawStar(g,0,26*i,7);
 
}
 
}
 
static void drawStar(Graphics2D g,int x, int y, int r)
 
static void drawStar(Graphics2D g,int x, int y, int r)
 
{
 
{
 
   Polygon star = new Polygon(
 
   Polygon star = new Polygon(
   new int[]{0,11,48,18,30,0,-30,-18,-48,-11},
+
   new int[]{0,22,95,36,59,0,-59,-36,-95,-22},
   new int[]{-50,-16,-16,6,41,18,41,6,-16,-16},10);
+
   new int[]{-100,-31,-31,12,81,38,81,12,-31,-31},10);
 
   g.translate(x,y);
 
   g.translate(x,y);
 
   g.scale(r/100.0,r/100.0);
 
   g.scale(r/100.0,r/100.0);
Line 24: Line 250:
 
   g.translate(-x,-y);
 
   g.translate(-x,-y);
 
}
 
}
</prog>
+
]]></answer>
 
</question>
 
</question>
 +
{{Assessment 2012}}

Latest revision as of 17:17, 19 October 2012

Each of these flags is worth 9 points.

Teresina

  • 284 by 208
  • Blue is RBG 8 41 140
  • Green is RGB 16 148 82
  • Yellow is RGB 255 239 8
  • The star has radius 32
Teresina


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

Sergipe

  • 300 by 200
  • Blue is RBG 8 41 140
  • Green is RGB 16 148 82
  • Yellow is RGB 255 239 8
  • The stars have radius 26 and 13
  • The centre of the small star is 20 from the edge
Sergipe


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

Maranhão

  • 300 by 207
  • Blue is RBG 0 41 140
  • Red is RGB 222 16 24
  • The star has radius 40
Maranhão


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

Mato Grosso

  • 300 by 200
  • Blue is RBG 40 22 111
  • Yellow is RGB 248 195 0
  • Green is RGB 0 146 63
  • The star has radius 50
  • Each point of the rhombus is 25 from the border
Mato Grosso


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

Naval Jack

  • 340 by 255
  • The blue RBG 0,41,140
  • The stars have radius 7
Naval Jack


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