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
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.
Step by Step Solution
There are 3 Steps involved in it
Here is the Java class ConsecutiveThree that implements the two methods getData and isConsecutiveThr... View full answer
Get step-by-step solutions from verified subject matter experts
