Consider the following declaration of the class numsequence, which has a constructor that is intended to initialize the instance variable seq to an arraylist of numberofvalues random floating-point values in the range [0.0, 1.0).

public class numsequence

{
private arraylist seq;
// precondition: numberofvalues > 0
// postcondition: seq has been initialized to an arraylist of
// length numberofvalues; each element of seq
// contains a random double in the range [0.0, 1.0)
public numsequence(int numberofvalues)
{
/* missing code */
}
}

what code segments could be used to replace /* missing code */ so that the constructor will work as intended?



Answer :

Other Questions