import java.util.ArrayList; /** * MarksAnalyser stores a collection of Student records. * Complete the code missing from methods below for practice * at using ArrayList and for-each loops * * @author (your name) * @version (a version number or a date) */ public class MarksAnalyser { /* * Arbitrary length list of Student objects representing a * specific group of students for a unit or lab class. */ private ArrayList courselist; /** * Constructor for objects of class MarksAnalyser */ public MarksAnalyser() { //TODO initialise instance variable(s) (fields) here } /** * Add a new student record to the class list. * @param member The Student object to be added. */ public void joinClass(Student student) { //TODO add code here } /** * @return The number of students (Student objects) in the class list. */ public int numberOfStudents() { return 0; //TODO replace code here } /** * Generate a class list of comma separated student names and marks * in a string with a newline after each student * @return String list of names and marks separated by commas and newlines */ public String showCourse() { return "\n"; //TODO replace code here } /** * Generate a class list of student names (only) in a string * @return String list of names separated by newlines */ public String showCourseNames() { return "\n"; //TODO replace code here } /** * Get a specific Student object record from the class list * @param String name of the student in the class list * @return Student object if the name is present or * null if the name does not appear in the class list */ public Student findStudent(String name) { return null; //TODO replace code here } /** * Find the minimum mark value, ignoring the student name * @return int the smallest of all values in the class list */ public int minimum() { return 0; //TODO replace code here } /** * Find the maximum mark in the ArrayList * @return int the largest value in the marks ArrayList */ public int maximum() { return 0; //TODO replace code here } /** * Find the average mark for the class list * @return double average value */ public double average() { return 0; //TODO replace code here } /** * Find the population standard deviation of marks in the class list * (see http://en.wikipedia.org/wiki/Standard_deviation) * You will need the functions Math.pow and Math.sqrt from the Math library * @return double value of the population standard deviation */ public double standardDeviation() { return 0; //TODO replace code here } /** * Find all students with a mark of threshold or above. * @param int threshold only Students with a mark of * at least threshold are returned * @return ArrayList of all Students who meet the cut off */ public ArrayList starStudents(int threshold) { return null; //TODO replace code here } /** * Challenge: generate a histogram as a string of *s * for the number of students in each bin * @param binsize of histogram divisions * e.g. binsize 20 groups marks into 0..19, 20..39 ... 80..100 */ public String printHistogram(int binsize) { return ""; //TODO replace code here } /** * Challenge 2: (rephrased) generate a histogram as a string of *s * with numbins division, as close in size as possible and * any remainder in the top bin. * @param numbins number of divisions in this histogram * e.g. binsize 5 can groups marks into 0..19, 20..39 ... 80..100 */ public String printHistogramImproved(int numbins) { return ""; //TODO replace code here } //TODO write informative test cases for this }