Assignment 8 – Flag Producer (ver. 2)

Maximum Points = 50

 

 The purpose of this lab is to continue your introduction to programming arrays in the Java programming language. In this assignment, you will write a program that reads data from two files containing a collection of flags and then allows a user to play a guessing game.

v  You MUST work with a classmate. In the comments, indicate the primary author of each class, method. Both names MUST appear in the documentation for each class and both students must submit the assignment.

v  You may use my solution to Assignment 6 where appropriate, but you MUST give me credit.

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

v  The files will consist of data (less than 100 flags of each type) for either vertical or horizontal  striped flags (each flag will consist of a country or state name, the number of stripes, followed by the specified number of  colors where each component will be separated by the comma (,) symbol as shown below:

 

vflags.txt                                                                    hflags.txt                                           

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

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

            :                                                                       Thailand,5,red,white,blue,white,red

                                                                                    Indonesia, 2, red , white

:

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

Sample flags:

                                                              

 

v  Your program must include a class(es) that will hold the 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(s) drawFlag that receives the x and y coordinates of the top corner of the flag and draws the flag at the specified location (assume all stripes are the same “width”).

v  Once your program has collected the data from the files and stored them in an array of Flags, you can start the second part of the program.

 

v  GUESS THE FLAG: you need to ask the user to describe their flag (vertical or horizontal striped? number of stripes?, and color of stripes). Based on the user input, your program will attempt to identify the flag and display it with the country’s name. If the flag is not in your lists, ask the user for a country/state name and display the flag.

v  Your listing should have an appropriate title at the top in a larger font (and different font face and color). Allow the user to continue playing the game until she/he wants to quit.

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, April 23, 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 30, 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)