ColorCollection - /* *Author: Alexander Marcos Schiffhauer...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
/********************************************************************* *Author: Alexander Marcos Schiffhauer * *Course: (600.107) * *Date: Due 07/06/2009 * *Assignment Number: pg7a: ColorCollection * *Phone Number: 1(914)-960-9981 * *WebCT Account Name: aschiff6 * *Email Address: aschiff6@jhu.edu or alexander.schiffhauer@gmail.com * *********************************************************************/ import java.util.*; import java.io.*; public class ColorCollection { static Random rand = new Random(); private String commandLine; private String commandLineSubstring; private char command; private String[] colors; private String[] tempColors; private String[] temporaryColors; private String[] saturation; private int[] tempSaturationOrder; private int[] greenArray; private int[] blueArray; private String[] subValue; private int highestGreen = -1; private int highestSaturation = -1; private int capacity = 5; private int numOfColors = 0; private int addNum1, addNum2, addNum3; private int red, green, blue; private String numberString = ""; private String newTransactionNumber = ""; private String numbers; /** This gets the transaction code from the input file. @param commandLine:gets the entire line. @param commandLineSubString: gets the transaction code from the commandLine @param command: converts to char */ public ColorCollection(Scanner fromFile) { colors = new String[capacity]; while(fromFile.hasNext()){ commandLine = fromFile.nextLine(); commandLineSubstring = commandLine.substring(0,1);//first letter commandLineSubstring = commandLine.toLowerCase(); command = commandLineSubstring.charAt(0); transaction(command); }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} /** This doubles the size of the array @param tempColors: a temporary array; holds values @param colors: the actual array used in the program @param capacity: the size of the array. */ public void colorContainer() { tempColors = new String[capacity]; System.arraycopy(colors, 0, tempColors, 0, capacity); if(capacity == numOfColors){ // if the two values are the same System.arraycopy(colors, 0, tempColors, 0, capacity);// copy the array
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/03/2010 for the course COMPSCI 600.107 taught by Professor Houlahan during the Spring '08 term at Johns Hopkins.

Page1 / 6

ColorCollection - /* *Author: Alexander Marcos Schiffhauer...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online