100044_1_softassignment by changcheng2


									This assignment is worth 50% of the overall Unit

Learning Outcomes Assessed:
1. Demonstrate the ability to apply problem decomposition to solve programming problems.

2. Demonstrate the ability to use and implement standard static and dynamic data

3. Demonstrate the ability to use a variety of programming techniques including pointers,
recursion and algorithms.

4. Reuse or implement appropriate software components to enable the modeling of novel

Criminal Records
You are to implement a Binary Search or AVL tree containing the details of known criminals. The
criminal object must minimally contain the following information

        Name
        Age
        Height
        List of Offences (use the built in LinkedList<> collection)
        Address

Store the objects in the tree using the name as the key for comparison.

You must implement a GUI (may be multiple forms) which allows the user to :

    1.   Add a Criminal
    2.   Display the number of Criminal Records in the system and depth of the tree
    3.   Search for a Criminal by Name
    4.   Remove a Criminal
    5.   Edit a Criminal’s details
    6.   Search for Criminals by a particular offence – should display all criminals committing that

The last two can be coded using the IComparable interface and implementing CompareTo as below
(requires completing). Alternatively you could use a non generic Tree though this will restrict the
marks available.

         public int CompareTo(object obj)
               if (obj is Criminal) //compare by name
                   Criminal other = (Criminal)obj;
                   return name.CompareTo(other.name);
               if (obj is string) //compare against list of crimes
                       return -999;      //indicates can’t make a comparison

Marking Scheme

To pass (40-50) a reasonable attempt at 1,2,3 – may be non generic, may have errors
50-60             as above and 4 – may have minor bugs
60-70             all 1-6 attempted – must be generic Tree Classes
70 -80%           all 1-6 fully working – must be AVL Tree
80+               as above with evidence of all bullet points below
Credit will be given for
       OO design - Complete and Working Classes
       Working Implementation
       Usability of the GUI
       Tested code – you can include a file of tests for different tree methods (Blackbox
       Validation

Hand-in :

    1. A hard copy of all your code stapled once in top left corner to coursework receipting office.
       This is needed to provide you with feedback.
    2. Please ALSO submit to moodle a zipped electronic version of your solution directory
       including the executable and all solution files.

Notes and help

                                           You can add events to controls in design time by selecting
                                           the control and clicking on the lightening strike in the
                                           properties box. Then select the event you want to add.

                                           Event documentation can be found at MSDN (google it).

Criminal Offences : you can set or get (a property)
for a linkedList<string>. This list can be
populated with the crimes using the
.AddFirst(string) method and displayed on a form using get and iterating through the list
contents (foreach) and adding to a ListBox for example.

You can add a picture of each criminal (get from web) displayed in a PictureBox on a form. You
would need to add a member string picture to Criminal class which stores the filename of the
appropriate picture.

There are a variety of techniques for dealing with multiple forms and transferring information
between them (see Moodle - unit resources- Handling Multiple forms… for one example of

Example for finding a criminal by a crime where you would create a new LinkedList<Criminal> then
call the Binary Search Tree Method below. The completed linkedList can then be used to populate a
ListBox or perhaps a Form for each found criminal.

//looks for a specific string, where CompareTo for T must be equipped
//to handle strings.
public void FindByStringItem(string item, ref List<T> list)
   findByStringItem(root, item, ref list);
private void findByStringItem(Node<T> t, string item, ref List<T> list)
{ //complete the code

To top