CSCI 220
HOMEWORK ASSIGNMENT #2
Assigned Date: Thursday, February 5, 2004
Due Date: Thursday, February 12, 2004
Due Time: Noon

 

Purpose:

This assignment focuses on selection.

Source filename to be submitted:  PoliceSketch.java

 

Documentation and submission:

See instructions in the first homework assignment.

Assignment: 

Write a police sketch program which outputs a customized face.  The program prints out the face based on user choices for hair type, eye style, mouth style, etc.  You should have at least three different parts to a head (e.g., hair, eyes, nose, mouth) and, for each part, at least three choices.

 

Sample Run 1: (user input in italics)

Choices of hair style

  1) parted

  2) curly

  3) balding

Enter choice: 2

 

Choices of eye style

  1) beady eyed

  2) wears glasses

  3) wide eyed

Enter choice: 3

 

Choices of mouth style

  1) smile

  2) frown

  3) surprised

Enter choice: 1

 

Your suspect looks like:

 

    @@@@@@@@@@@@@@

   @@@@@@@@@@@@@@@@

   |              |

   |              |

   |   (*)  (*)   |

   |              |

  _|              |_

 |_                _|

   |   |______|   |

   |              |

 

  

Optional Bonus Step:  

Add a fourth choice to each of the three face parts which will let the program choose randomly the given feature.  To do so, employ the method Math.random() .

 

Notes:

  1. You may assume that the input to your program is error-free, i.e., the user will input a non-negative integer.
  2. Follow the above I/O format carefully.
  3. Test your program with different inputs to ensure that it works properly.

 

Addendum:

 

   Below are some additional faces, in case you run out of artistic steam:

 

  ||||||||||||||||        ||||||||||||||||       ||||||||||||||||

  |              |        |              |       ||||||||||||||||

  |              |        |  --      --  |       ||||||||||||||||

  |    o     o   |        | |  | -- |  | |       |              |

  |              |        | |o |/  \|o | |       |    o     o   |

 _|              |_       | |__|    |__| |       |              |

|_                _|      |              |      _|              |_

  |   |______|   |        |    ///|\\\   |     |_                _|

  |              |         \            /        |              |

  |              |          \     o    /         |   |______|   |

                             \________/          |              |

 

 

       ,,,,,,,

      ///////\\

     ////////\\\

     ///////,\\\\

    ////~   ~ \\\

    /// 0   0 |\\

    //|   ^   |\\

    /||       ||         

     * \ \_/ / *

        \___/

         

         

    ___\\\|///__

   /            \

  /              \

  |   ___   ___  |

  |--| o |-| o |-|

  |   ---   ---  |

 _|       ^      |_

|_                _|

  |   ////\\\\   |

  |  /|______|\  |

  |||          |||

    |||      |||

       \\\///

 

 

 

Credits

This assignment was developed by Owen Astrachan.