notes book homework list contact POWERSCHOOL  
 

Array practice 2 - read the code:

 

Worth 5 hw points


/**
 * In the real world, you often are going to have to deal w/ data and often it will not be in the formating you want.  One of the most 
 * common tasks is manipulating that data.
 * The exercise today will be an example of that.
 * I printed out a long string of all the names in the class, seperated by commas (see below).
 * I would like a method that will change that into a string.
 *
 * In groups of 2, you are going to complete the following exercise.
 * It is worth 5 hw points - due tomorrow(as well as last nights work)
 * 
 */
public class arrayPractice2
{
    String allNames="Kyle Beaudet,Mario Bove,Matthew brooks,Sanjay Choolani,Michael Cowie,Brody Cullenberg,Keith Felker,Micah Getson," +
                    "Edward Googins,Michael Huang,Jeff King,Leonard Larsen,robert lorrain,Loc Nguyen,Nenad Radovic,Jake Regier,Tom Robinson,"+
                    "Will Schoen,Hussan Shareef,Alex Tooher,Chi Chi Wang";
    String studentNames[]=new String[21];
    
    //Go through the string allNames above and use those names to fill in the array studentNames
    //So for example afterwards studentNames[0] would be Kyle Beaudet and so on.
    //But you CANT do it manually, that would be insane.
    //You will need to use substring and indexOf(int ch, int fromIndex) 
    //      see: http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html
    //Extra credit goes to the group that does it the most cleverly.
    public void fillArray()
    {
    }
    
    //create a method that will print out the array in table format (so 7 rows of 3 names)
    public void printArray()
    {
    }
    
    //Extra Credit - sort the array - by last name
    public void sortArray ()
    {
    }
}