Question
This question needs java programming. SameEnds Write a class named SameEnds. Write a SameEndsTester to test your class. SameEnds determines whether an array list has
This question needs java programming.
SameEnds Write a class named SameEnds. Write a SameEndsTester to test your class. SameEnds determines whether an array list has the same sequence of numbers at the left and at the end, and if so, how long that sequence is. You will not prompt the user for data. Enter your test data via a SameEnds constructor from SameEndsTester. You may assume that all of the elements in the array list are integers.
For example, the array list 1 4 9 10 11 12 1 4 9 has the same sequence 1 4 9 at the left and the right, and it has length 3.
Therefore, your SameEndsTester would print out The longest sequence is 1 4 9, and the sequence length is 3.
If the arraylist doesn't have a common sequence at the left and the right, such as 1 4 9 16 25
SameEndsTester should print out There are no common sequences. The two sequences cannot overlap.
For example, in the array 1 1 1 1 the sequence 1 1 occurs at the left and the right, and your method should return The longest sequence is 1 1, and the sequence length is 2.
Here is extra link to instructions for easier reading.
https://docs.google.com/document/d/196RKXFVSmRrEF5BvCj4QpzGhFcYRGOj7M2dsSE_59KU/edit?usp=sharing
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started