Difference between revisions of "Tutorial/Flags"

From Progzoo
Jump to: navigation, search
Line 1: Line 1:
Libya
+
    *  You may want to review:  drawing and filling rectangles before tackling these questions.
The flag of Libya is a green rectangle.
+
    * You might want to try coordinates exercises if you are not comfortable with x,y coordinates.
<question title='L' imgOut='flag.png' width='300' height='200'
+
 
 +
 
 +
==Libya==
 +
<question title='Libya' imgOut='flag.png' width='300' height='200'
 
   className="Raster">       
 
   className="Raster">       
<blurb>Here we go </blurb>
+
<blurb>The flag of Libya is a simple green rectangle.<br/>
 +
 
 +
Try the program as it is given, then change it so that the green rectangle is wider.
 +
<img src='http://progzoo.net/img/flaglibya.png'/>
 +
</blurb>
 
<prog lang="java">
 
<prog lang="java">
 
static void drawFlag(Graphics g){
 
static void drawFlag(Graphics g){
Line 41: Line 48:
 
}
 
}
 
]]></shell>   
 
]]></shell>   
 +
</question>
 +
==France==
 +
<question title='France' imgOut='flag.png' width='300' height='200'
 +
  className="Raster">     
 +
<blurb>The flag of France is blue, white and red.
 +
 +
The code given draws only one of the three rectangles required, and it is in the wrong place.
 +
<img src='http://progzoo.net/img/flagfrance.png'/>
 +
</blurb>
 +
<prog lang="java">
 +
static void drawFlag(Graphics g){
 +
  g.setColor(Color.blue);
 +
  g.fillRect(200,0,100,200);
 +
}
 +
</prog>
 +
<answer lang="java">
 +
static void drawFlag(Graphics g){
 +
  g.setColor(Color.blue);
 +
  g.fillRect(0,0,100,200);
 +
  g.setColor(Color.white);
 +
  g.fillRect(100,0,100,200);
 +
  g.setColor(Color.red);
 +
  g.fillRect(200,0,100,200);
 +
}
 +
</answer>
 
</question>
 
</question>

Revision as of 16:30, 24 October 2007

   *   You may want to review:  drawing and filling rectangles before tackling these questions.
   * You might want to try coordinates exercises if you are not comfortable with x,y coordinates.


Libya

The flag of Libya is a simple green rectangle.

Try the program as it is given, then change it so that the green rectangle is wider. <img src="http://progzoo.net/img/flaglibya.png"/>



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

France

The flag of France is blue, white and red.

The code given draws only one of the three rectangles required, and it is in the wrong place. <img src="http://progzoo.net/img/flagfrance.png"/>



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