NEed HELP starting it off..not sure what im doing wrong..Please!!

The Percentile class
The constructor of your class should have one parameter representing the capacity of the array that the class will contain. The array should be a double array with its length equal to the capacity. You will also need to keep track of how many values have been added to the array (called the "size" of the array), which will be initially 0. The capacity and size will correspond to fields of the Percentile class and should have accessor methods for the size and capacity. However, do not provide an accessor method for the array. The Percentile class should also have a toString method that returns a String describing the object, including elements of the array. The elements of the array should be listed on a single line, separated by commas. There should not be a comma after the last element.
Also create a PercentileTester class that will have a main method that will start by printing a line containing your name. It will then test the Percentile class by constructing several instances and printing enough information to test the accessor and toString methods of the class.

package pr02;

public class Percentile {
    private int mySize = 0;
    private double myCapacity;
    private double [] array;
    //private Percentile[] array; 
    //private double [] myArray = new double[myCapacity];

    public Percentile(double[] capacity){
        array = capacity;


    public double getCapacity(){
        return myCapacity;

    public int getSize(){
        return mySize;

    public String toString(){
        return "The Capacity is " + myCapacity+ "and the Size is" +mySize;


It says to pass the capacity to the constructor. The capacity of an array is simple how many slots/indexes it should have. This is an int, not a double, and the array should be created to be the size passed in. Look up how to create an array in Java. And also use code tags next time.

This article has been dead for over six months. Start a new discussion instead.