CS 160, Spring 2015
Programming Quiz Q5
Practice Programming Quiz

Must be completed during recitation on May 4-6.

You have 50 minutes to complete the quiz.



  1. Create a project called Q5 in Eclipse.
  2. Create a class called Q5 in the project Q5 with a main method.
  3. Download QuizInterface.java to the source (workspace/Q5/src) directory.
  4. Download input.txt to the project (workspace/Q5) directory.
  5. Make your Q5 class implement this interface.
  6. Use Eclipse to add empty methods for all the methods required in the interface.
  7. Create the following public static class variables.

  8. Initialize all integer counters to zero when they are declared.
  9. Allocate and initialize testArray with the values: 92.2, 45.9, 16.4, 31.2, 67.8, 95.0, 71.1.
  10. Do not allocate or initialize the fileContents array.

Instructions for each method:

  1. readFile

  2. computeStatistics

  3. printStatistics

  4. writeFile
  5. findLargest

TESTING: Test your methods by creating a Q5 object and using it to call each method, for example:

	Q5 q = new Q5();
	q.writeFile(args[1], fileContents);
	System.out.println("Array = " + Arrays.toString(testArray));
	System.out.println("Largest value = " + q.findLargest(testArray));

You must submit your Q5.java program to the Checkin tab to get graded for Programming Quiz 5. Automated grading is enabled and you can submit multiple times.
© 2015 CS160 Colorado State University. All Rights Reserved.