Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Beg your correctly answer code , thank you every much. Your task is to write a new project titled Programming ProjectE7-23E7-25 based on exercises E7.23

Beg your correctly answer code , thank you every much.

image text in transcribed

image text in transcribed

Your task is to write a new project titled Programming ProjectE7-23E7-25 based on exercises E7.23 and E7.25 in your textbook. This project will consist of two classes. Sequence . Start the Sequence with the instance variables, constructor, and methods outlined in E7.23 In addition to the constructor, add, and toString methods you will add two additional methods to the Sequence class public Sequence append(Sequence other) exercise E7.23 public Sequence merge(Sequence other) exercise E7.24 O O Sequence Tester . . . This class serves to test the Sequence class It should have the main method, it may have more methods if you would like. The class should create two Sequence objects: sequence1 and sequence2 The class should add elements to sequence1 and sequence2 The class should call append on sequence1 and appended sequence2 to sequence1, assign the result to a new Sequence, sequence3, and print the results. The class should call merge from sequence1 and merge sequence2 to sequence1, assign the result to a new Sequence, sequence4, and print the result. . E7.23 Consider the following class: public class Sequence { private ArrayList values; public Sequence() { values = new ArrayList(); } public void add(int n) { values.add(n); } public String toString() { return values.toString(); } } Add a method public Sequence append(Sequence other) that creates a new sequence, appending this and the other sequence, without modifying either sequence. For example, if a is 149 16 and b is the sequence 974911 then the call a.append(b) returns the sequence 149 16 9 74 9 11 without modifying a or b. E7.24 Add a method public Sequence merge (Sequence other) to the sequence class of Exercise E7.23 that merges two sequences, alternating elements from both sequences. If one sequence is shorter than the other, then alternate as long as you can and then append the remaining elements from the longer sequence. For example, if a is 14916 and bis 974911 then a merge (b) returns the sequence 1947 94 16 9 11 without modifying a or b

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

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Question How is life insurance used in a DBO plan?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago