banner



What Is The Easiest Flag To Draw

CITS1200 FlagDrawer

This lab sheet contains work that is to be submitted for assessment and will contribute to 3% of the final mark in this unit.

Submission is via cssubmit

Details concerning what must be undertaken and submitted are given below.

Assessed Lab - Flags of the World

Acknowledgement: the flag pictures and information come from the World Flag Database. The flag selection was based purely on the suitability of the images for a computer graphics project.

In this lab we will write a class called FlagDrawer that will have methods for drawing a variety of flags. In the lab session, we will help for drawing the first 10 flags (the Libya flag is excluded). You must be very creative if you want get the full marks. Do as many of them as you can!

For example, the Luxembourg flag (height:width 3:5) looks like this:

We could draw it as follows:

public void drawLUX(int width) {    int height = width * 3 / 5;   SimpleCanvas c = new SimpleCanvas("Luxembourg flag", width, height);    // This draws the top stripe as a bunch of horizontal lines   c.setForegroundColour(java.awt.Color.red);   for (int i = 0; i < height/3; i++) {     c.drawLine(0, i, width, i);   }    // This draws the bottom stripe the same way    c.setForegroundColour(java.awt.Color.cyan);   for (int i = height * 2 / 3; i < height; i++) {     c.drawLine(0, i, width, i);   } }              

Make sure you understand drawLUX before you start. Note the following.

  1. Flags come in different aspect ratios, so ratherIn the lab session, we will help for drawing the first 10 flags (the Libya flag is excluded). You must be very creative if you want get the full marks! than having the SimpleCanvas being an instance variable of FlagDrawer, we will get each method to create its own SimpleCanvas with the correct proportions. Each method takes as its argument the width of the flag, then it sets the height accordingly. Your methods must work for any reasonable value of width.
  2. This flag was drawn with height/3 horizontal red lines at the top and the same number of horizontal cyan lines at the bottom, leaving (notionally) white lines in-between.
  3. The method uses java.awt.Color for the standard colours used here. You can access the interface and documentation for this class from the BlueJ Tools menu. The class also provides methods for constructing less common colours: probably easiest to use is the Color constructor that takes three ints. (Your colours don't need to be absolutely precise, though.)
  4. When the method finishes, the local variable c will be destroyed; however the actual window on your screen will not be deleted. This means that if you call the method again, you will get a new window.

Very, Very Easy Flags

  1. Libya (LY) (height:width 1:2)

Easy

  1. Ukraine (UKR) (height:width 2:3)

  2. France (FR) (height:width 2:3)

  3. Thailand (TH) (height:width 3:5, stripes 1:1:2:1:1)

  4. Gambia (GA) (height:width 2:3, stripes 3:2:3 plus gaps)

Medium

  1. UAE (UAE) (height:width 1:2, the red is 1/4 of the width)

  2. Finland (FI) (height:width 11:18, the stripe is 1/7 of the width and centred 1/3 of the way along)

  3. Switzerland (SW) (height:width 1:1, the cross breaks the flag symmetrically into fifths)

Getting harder

  1. Congo-BrazzaVille (CB) (height:width 2:3, the yellow is 1/3 of the width)

  2. Seychelles (SY) (height:width 1:2, the diagonals break the width and height into thirds)

  3. Scotland (SC) (height:width 3:5, each arm of the cross is 1/5 of the width)

Hard

  1. Qatar (Q) (height:width 11:28, the dashes are centred 1/3 of the way along)

  2. South Africa (SA) (height:width 2:3, measure it yourself!)

  3. Japan (JP) (height:width 7:10, the circle is centred and its diameter is 1/3 of the width)

  4. Greenland (GD) (height:width 2:3, the "circle" is 10% off-left and its diameter is 1/2 of the width)

  5. Western European Union (WEU) (height:width 2:3)

Really quite hard indeed

  1. South Korea (SK) (height:width 2:3)

  2. Algeria (AG) (height:width 2:3)

  3. Antigua & Barbuda (AB) (height:width 2:3)

Don't even bother!

  1. Hong Kong (HK) (height:width 2:3)

  2. Albania (AN) (height:width 5:7)

  3. Wales (WS) (height:width 3:5)

Specification

The FlagDrawer class should implement as many of the following methods as you can.

  1. public void drawUKR(int width)
  2. public void drawFR(int width)
  3. public void drawTH(int width)
  4. public void drawGA(int width)
  5. public void drawUAE(int width)
  6. public void drawFI(int width)
  7. public void drawSW(int width)
  8. public void drawCB(int width)
  9. public void drawQ(int width)
  10. public void drawSC(int width)
  11. public void drawSY(int width)
  12. public void drawJP(int width)
  13. public void drawGD(int width)
  14. public void drawSA(int width)
  15. public void drawSK(int width)
  16. public void drawAG(int width)
  17. public void drawAB(int width)
  18. public void drawHK(int width)
  19. public void drawAN(int width)
  20. public void drawWS(int width)

Each method should draw the flag of the country whose code is in the method name. You may just omit the methods you do not want to submit. The final exam usually contains a flag-drawing question, so selecting only the easiest flags is likely to be costly in the long run. Also notice that the Libyan flag is deliberately omitted from your list of choices.

You must ensure that your method signatures match the above or they will not be marked. No validator is provided, and no JUnit tests are provided: test your methods by inspecting the flags drawn for various values of width. We recommend that you follow the CS-readability checkstyle rules.

Marking

Marks will be allocated as follows:

  • 3 marks for 14+ reasonable-looking flags, otherwise
  • 2 marks for 10+ reasonable-looking flags, otherwise
  • 1 mark for 7+ reasonable-looking flags, otherwise
  • 0 marks.

Your flags do not have to be pixel-perfect, but they must be clearly recognisable by eye. You must have roughly the right colours, and the right markings with roughly the right shapes and dimensions.

You may want to write some private helper methods that can be called to simplify the drawing of your flags. For example a method that draws a coloured rectangle specified by the coordinates of its top-left corner (x1,y1) and its bottom right corner (x2, y2) would be handy:

private void colourRectangle(int x1, int y1, int x2, int y2, java.awt.Color colour, SimpleCanvas sc)              

Top of Page

CRICOS Provider Code: 00126G

What Is The Easiest Flag To Draw

Source: https://teaching.csse.uwa.edu.au/units/CITS1200/Laboratories/FlagDrawer/

Posted by: parentdights.blogspot.com

0 Response to "What Is The Easiest Flag To Draw"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel