Information and Pictures

This file contains detailed information about each flag required for Project 3 and pictures of each flag (some in different sizes). Realize that these are just examples - just a few chosen sizes. From the descriptions and examples for each you will need to extrapolate and implement an algorithm that will work on any valid size for that flag.

Task 0: Explore Our Code
Before you start working on the flag tasks, it would be a good idea to look at our implementation for the silly example and think about what it does. Then look at the drawSultanateOfMuscat and the helperField method and think about what they do and how. Then, look at how the existing code in the drawFlag method deals with choice 0 (for the silly example), and then look at how we handle choice 1 (the Sultanate of Muscat flag) and the restriction we have enforced on that being that we only allow flags whose height is odd and at least 7. You might also find it useful to run the ExampleDriver and try those two flags at different sizes to see how it all looks.


Task 1: Invalid/Error Flag
The error flag has a solid WHITE field (background) with a single colored square in each of the four corners; RED in the upper-left, GREEN in the upper-right, BLUE in the lower-left, and ORANGE in the lower-right. Remember that our row and col indices start at 0, so if (for example) you "ask" a Grid_3x5 object its width using the getWd() method, you would have to subtract one from that value if you wanted to indicate the last column of that grid.

The error flag will be displayed under any of the following circumstances:
• If the scale given by the user between 2 and 12 (inclusive), but the dimensions are not allowed by that specific flag as defined below, the error flag is displayed in the scale given by the user.
• If the size given is less than 2, the example driver creates a flag that is 6 high in which you will display the error flag.
• If the size given is greater than 12, the example driver creates a that is 6 high in which you will display the error flag.
• If the flag scale is between 2 and 12 (inclusive), but the flagCode is not one provided by the menu, an error flag of the specified scale is created.

Error 2
Scale 1 requested, but due to that being too small, a Scale 2 error flag is displayed.


Error 12
Scale 4 (12x20) requested on flag that needs odd height



Task 2: The flag of Rif
• The flag for Rif is solid RED with a WHITE diamond in the middle.
• The height of the flag must be ODD.
• If an even value is given then the error flag must be drawn instead.

Rif 3
Scale 3 (Height 9)


Rif 5
Scale 5 (Height 15)



Task 3: The flag of Canton of Ticino and the flag of Prague
• Our flag for the Canton of Ticino is PINK on the top half and CYAN on the bottom half.
• The height of the flag must be EVEN.
• If an odd value is given, then the error flag must be drawn instead.

Canton Ticino 2
Scale 2 (Height 6)


Canton Ticino 4
Scale 4 (Height 12)



• Our flag for Prague is YELLOW on the top half and RED on the bottom half.
• The height of the flag must be EVEN.
• If an odd value is given, then the error flag must be drawn instead.

Prague 4
Scale 4 (Height 12)



Task 4: The flag of Myanmar
Remember, the flag of Myanmar is the one for which you are required to write out your pseudocode and trace it on paper and turn it on in ELMS before you start to write the Java code in Eclipse.

• Our flag for Myanmar has three equal horizontal stripes and a diamond.
• The top third is YELLOW
• The middle third is GREEN361
• The lower third is RED
• There is a WHITE diamond in the middle
• The Color class doesn't have a green close enough to this flag, so a constant local to our FlagMaker class has been created for you. Its name is GREEN361.
• The width for this flag must be ODD (if a non-odd width is available the error flag must be drawn instead).


Myanmar 3
Scale 3 (Height 9, Width 15)


Myanmar 5
Scale 5 (Height 15, Width 25)



Task 5: The flag of Norfolk and the flag of Vincent
• Our flag for Norfolk has three unequal horizontal stripes in a ratio of 3:4:3.
• The left-most stripe is GREEN
• The middle stripe is WHITE
• The right-most stripe is GREEN
• The width for this flag must be a multiple of ten.
• If a non-multiple of ten is given, the error flag must be drawn instead.


Norfolk 2
Scale 2 (Width 10)


Norfolk 4
Scale 4 (Width 20)


• Our flag for Vincent also has three unequal horizontal stripes in a ratio of 3:4:3.
• The left-most stripe is BLUE
• The middle stripe is YELLOW
• The right-most stripe is GREEN
• The width for this flag must be a multiple of ten.
• If a non-multiple of ten is given, the error flag must be drawn instead.


Vincent 2
Scale 2 (Width 10)



Task 6: The flag of Hour Glassville
• The flag for Hour Glassville has a solid BLACK field (background) with a GREEN hourglass in the middle.
• The best way to visualize this is probably having a field of GREEN and then over-painting two BLACK triangles on each side.
• The height for this flag must be ODD.
• If other values are given, then the error flag must be drawn instead.


Hourglass 3
Scale 3 (height 9)


Hourglass 5
Scale 5 (height 15)




CHALLENGE 1: The flag of Sheltopia
• The flag for Sheltopia has concentric YELLOW rectangles on a field of AZURE.
• The height for this flag must be ODD.
• The center of the flag must never turn yellow, so stop drawing concentric rectangles if the next one drawn would be solid.
• If other values are given, then the error flag must be drawn instead.


Sheltopia 3
Scale 3 (height 9)


Sheltopia 5
Scale 5 (height 15)




CHALLENGE 2: The flag of Youville
For the flag of Youville, you get to come up with some design that can be described geometrically that scales, and then implement it.

You must have all of the required flags working perfectly before we will look at a Youville flag.

Send me e-mail letting me know if you have done a Youville flag with a screenshot of what it looks like in the Drawing Grid dialog box.

The TAs and I will look through these and try to pick a few to share with the class (note that we will run your Java code to generate it just to make sure it's real).




Web Accessibility