Question: Urgent Make sure to ask user for input & create two classes, one of them containing the main method public class ArrayOfRandomNums { //Replace this

Urgent

Make sure to ask user for input & create two classes, one of them containing the main method

public class ArrayOfRandomNums {

//Replace this comment with a declaration statement

//for an array of integers as an instance variable

//Replace this comment with a default constructor to instantiate an array of

//50 elements. Populate the array using random integers between 1 and 100.

//Replace this comment with an overloaded constructor to instantiate

//the array using the parameter for number of elements.

//Populate the array with random integers between 1 and 100.

//Traverse the array, count and return the number of odd

//numbers in the array

public int numOdds() {

return 0;

}

//Traverse the array, count and return the number of even

//numbers in the array

public int numEvens() {

return 0;

}

//Precondition: x is an integer between 1 and 100, inclusive

//Postcondition: occurs returns the number of times x occurs in the array

public int occurs (int x) {

return 0;

}

//Precondition: d is an integer not equal to 0

//Postcondition: The number of times each element is divisible by d is returned

public int divisibleBy(int d) {

return 0;

}

//Postcondition: Prints the subscript and element whenever adjacent

//elements are values that are ascending and consecutive

public void consecPairs() {

}

//Precondition: s is an integer greater than 1

//Postcondition: The subscript and element is printed whenever a set of s

//adjacent elements are ascending and consecutive

public void consecSets(int s) {

}

//Display the array in n rows of 10 numbers

public String toString() {

return "";

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!