Write a Java class Consecutive Three that can prompt user to enter a specific number of integers
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a Java class Consecutive Three that can prompt user to enter a specific number of integers to create an integer array, and then test to see whether the array contains three consecutive numbers with the same value. In the class definition, in addition to the main method, please implement the following two methods:
public static int[] getData(): which will first prompt the user to specify the number of integers, and then ask her to enter that number of integers. Store all entered numbers into an array, and return that array. Public static boolean isConsecutiveThree(int[] arr): determine whether the array contains consecutive three numbers with the same value.
Involve the above two methods in the main method.
Related Book For
Posted Date: