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

1 Expert Approved Answer
Step: 1 Unlock

Here is the Java class ConsecutiveThree that implements the two methods getData and isConsecutiveThr... View full answer

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 Programming Questions!