Write the following methodthat tests whether the array has four consecutive numbers with the same value:public static boolean isConsecutiveFour(int[] values)Write a test program that prompts the user to enter a series of integers and displaysit if the series contains four consecutive numbers with the same value. Yourprogram should first prompt the user to enter the input size—i.e., the number ofvalues in the series. Here are sample runs:   Enter the number of values: 8↵EnterEnter the values: 3 4 5 5 5 5 4 5↵EnterThe list has consecutive foursEnter the number of values: 9↵EnterEnter the values: 3 4 5 5 6 5 5 4 5↵EnterThe list has no consecutive fours

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

Write the following method
that tests whether the array has four consecutive numbers with the same value:
public static boolean isConsecutiveFour(int[] values)
Write a test program that prompts the user to enter a series of integers and displays
it if the series contains four consecutive numbers with the same value. Your
program should first prompt the user to enter the input size—i.e., the number of
values in the series. Here are sample runs:

 

Enter the number of values: 8↵Enter
Enter the values: 3 4 5 5 5 5 4 5↵Enter
The list has consecutive fours
Enter the number of values: 9↵Enter
Enter the values: 3 4 5 5 6 5 5 4 5↵Enter
The list has no consecutive fours

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage