Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write JAVA a class named SameEnds. Write a SameEndsTester to test your class. SameEnds determines whether an array list has the same sequence of numbers

Write JAVA 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.

Turn in your 2 .java classes, SameEnds and SameEndsTester.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Deductive And Object Oriented Databases Second International Conference Dood 91 Munich Germany December 18 1991 Proceedings Lncs 566

Authors: Claude Delobel ,Michael Kifer ,Yoshifumi Masunaga

1st Edition

3540550151, 978-3540550150

More Books

Students also viewed these Databases questions