RandomSelection

We are surrounded by Computation! This program was written to solve my need to randomly select student answers for the Daily Question. The basic idea is to prepare two lists -- one with the AM student names and one with the PM student names. Then randomly select a batch of students on each day, so all students can participate in getting a Daily Question right.

This is to be done THREE times, based on the number of exams. For exam #1, there are SIX days for selection. For exam #2, there are EIGHT days. For exam #3, there are TEN.

The problem requirement defines my input:

The output is:

Tasks

Given the description above, there are a set of tasks that must be accomplished.

  1. Read in the list of student names. For now, we assume that we know the number of student names in advance, so the format of the output is going to be a number (on a line by itself) representing the number of students, then one-per-line, the student information, like this:

     
    10
    Heineman, George T       CS
    Auburn, Christopher J    ECE
    Clinton, William J       PS
    Bush, George Herbert WalkPS
    Pinkett Smith, Jada      IE
    ...

    We will be using a String array (presented in class on Oct-31) to store all student names
     

  2. We need to process each line, to extract the "First Last" names of the students, and ignore the major
  3. We need to read in the number b representing the batch size
  4. For simplicity, I am going to generate output as I process the array of student names

Initial Design

The task decomposition naturally produces a design that we will use

package heineman.cs2102;

import java.util.Scanner;            // to be discusses Oct-30

public class GenerateBatches {

   /** Main routine. */
   public static void main (String []args) {

         // INPUT: Load up the student names into an array

         // PROCESSING: Create a new array into which the original is "shuffled"

         // OUTPUT:  Output the shuffled array by batches. There will be some
         //                names left over; these are to be shown as "extra"
   }

}

See the Advanced section of the code examples for the final source...