MCC - CIS162AD
CS12a Array Processing (Part 1) - 15 points
CS12b Array Processing (Part 2) - 15 points
      cs.gif

This project is separated into two assignments, so there will be two separate submissions, CS12a and CS12b.

In Part 1 (CS12a) of the assignment students will code array declarations, load parallel arrays, look up array values, and display the content of the arrays.

In Part 2 (CS12b) of the assigment students will sort and search the parallel arrays.

Customer information (id, name, discount code) stored in a data file will be loaded into three parallel arrays. The discount code will then be looked up in a discount code array to get the discount rate. The appropriate discount rate should then be loaded into the 4th parallel array. The values in the four parallel arrays will be displayed in list boxes so that manipulation of the data can be displayed. Two constant arrays to store the discount codes and discount rates will be needed.

The four parallel arrays should be able to hold up to 10 customers. The program should allow the user to load the arrays once, sort by id, sort by name, and search by name. The name to search for will be entered in a textbox. If there is a match in the list, the name and its corresponding data should be selected in the list boxes. If the name is not found, a message should be displayed in a label. The early exit logic should be included in the search routine (see lecture notes and cs12ex).

Sample Form:

Sample Form (cs12_interface.jpg)

Additional Notes:

Source Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

//Project:     CS12 Array Processing
//Programmer:  Your Name
//Description: Load a list of Customer Ids, Names, and Discount Codes from a file.
//             The list can hold up to 10 customers.
//             Lookup the discount code in a array to get the discount Rate. 
//             Data is displayed in list boxes.
//             The user can sort the list by Id or Name and search by name.

using System.IO;  // FileStream and StreamReader

namespace CS12
{
    public partial class frmCS12 : Form
    {
        public frmCS12()
        {
            InitializeComponent();
        }


//CS12a Part 1 


        //Declare class-level arrays

        //Use cintNumberOfCustomers to process arrays because arrays 
        //may be partially loaded.  Count set in LoadArrays.
        int cintNumberOfCustomers;

        //Declare constant arrays
        //Size of array determined by the number of values provided.
        //Note the values are enclosed in braces and not parenthesis.


        private void btnLoadArrays_Click(object sender, EventArgs e)
        {

        }


        void assignDiscountRate()
        {
  
        }


        void displayArrays()
        {
            //This method is a look up routine.
            //The items being compared must match exactly, so the comparison operator to use is ==

        }



//CS12b Part 2 


        private void btnSortById_Click(object sender, EventArgs e)
        {
 
        }


        void swapArrayValues(int i, int intMinSubscript)
        {

        }
		

        private void btnSortByName_Click(object sender, EventArgs e)
        {
  
        }


        private void btnSearchByName_Click(object sender, EventArgs e)
        {
            //Include Early Exit logic
            //An early exit from a search can occur when we know that
            //the value we are looking for will not be found in the array.  To
            //implement an early exit, the array most be sorted ascending.
            //If we can determine that a value will not be found, we should
            //not search the remainder of the array.

        }


        private void btnExit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

    }//end of class
}//end of namespace

Revised: 08/26/2011 - www.mesacc.edu/~marquez/cis162ad/cs12_arrays.html