Data File

Download declaration.txt to the project (workspace/Q6) directory.

Test Code

        double[] myDoubles = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};
        initializeArray(myDoubles);
        System.out.println("Array: " + Arrays.toString(myDoubles));
        double sum = sumRange(myDoubles, 3, 6);
        System.out.printf("Sum: %.1f\n", sum); 

        String lines[] = readFile(args[0]);
        System.out.println("Number of Lines: " + lines.length);
        int frequency = substringFrequency(lines, "from");
        System.out.println("Found " + frequency + " occurrences of 'from'."); 
        frequency = substringFrequency(lines, "the");
        System.out.println("Found " + frequency + " occurrences of 'the'.");
        writeFile(args[1]);


© 2016 CS160 Colorado State University. All Rights Reserved.