Assignment 6 – Flag Producer

Maximum Points = 50

 

 The purpose of this lab is to continue your introduction to user-defined classes and to the Scanner, File, and Frame classes in the Java programming language. In this assignment, you will write a program that reads data from two files and then display a collection of flags of a user-selected type.

v  Your program must read the data from two files called vflags.txt and hflags.txt  NOTE: you will need to use the comma delimiter as illustrated in the examples to separate the data components.

v  The file will consist of data for five (5) tri-color flags (each flag will consist of a country name, followed by three colors (top, middle, bottom or left, middle, right) where each component will be separated by the comma (,) symbol as shown below:

 

vflags.txt                                                                                            hflags.txt

Italy, green, white, red                                                         Bulgaria,white, green, red

Chad, blue, yellow, red                                                       Seirra Leone, green, white, blue

            :                                                                       :

 ------------------------------------------------------------------------------------------------------------------------------

Sample flags:

                                                                                

 

v  Your program must include a class(es) that will hold each type of flag data (complete with constructor(s), get and set methods for each instance variable, and a toString method that returns the contents of the instance variables).

v  Include an additional method drawFlag (see page 113 of Big Java) that receives the x and y coordinates of the top corner of the flag and draws the flag at the specified location (assume all three stripes are the same “width”).

v  Once your program has collected the data from the files, you need to ask the user which type of flag (horizontal or vertical) to display and then display the five flags of the specified type on the same screen using a JFrame.

v  Your listing should have an appropriate title at the top in a larger font (and different font face and color). The listing of the five flags should display the country name with the flag.

v  Modularize your program to minimize the amount of changes you would need to make if we change the number of flags.

 

EXTRA CHALLENGES:                

i) add additional types of flags [http://www.flagdetective.com/], e.g. bicolors, solids.

ii) add an optional image in the center of the flag.

 


Make sure that your program uses proper indentation and complete documentation. See http://csc.columbusstate.edu/summers/NOTES/1301/style.htm for guidelines.

The program heading should occur at the top of the program and should include:

               /**
                * PROGRAM SPECIFICATIONS
                * NARRATIVE DESCRIPTION:
                *
                * @author (your name) 
                * @version (date)
                */

 

  (Due before 8 a.m. on Monday, March 26, 2012) Submit a .doc file containing the UML class diagrams (including the “main” class) showing inheritance for all the classes used in your program and your timesheet documenting your time so far to the dropbox in WebCT. [10 pts]

(Due before 8 a.m. on Monday, April 2, 2012) Submit your .java files containing your program and your timesheet documenting your time to the dropbox in WebCT.

 Grades are determined using the following scale:

  Header..………………….:___/2

  Data members……..……:___/4

  Methods..………………..:___/4

 

  • Runs correctly..…………………:___/10
  • Correct output……..……………:___/10
  • Design of output..………………:___/8
  • Design of logic…………………:___/10
  • Standards……………………….:___/7
  • Documentation.………………...:___/5

 

Grading Rubric  (Word document)