Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my homework. Please read the rubric before coding. The screenshots that I've attached are 5 exercises that explain which method needs

I need help with my homework. Please read the rubric before coding. The screenshots that I've attached are 5 exercises that explain which method needs to be made. Each method of those exercises must be included in the ArrayIntList.java file that I pasted bellow. It also needs a test client program which will run and test the code. I need help with completing those methods and putting them in the ArrayIntList.java file. I also need help with the test client code. Thank you so much for your help!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
11. Each of these exercises require you add the named method to the ArrayIntList class created in the text. There is a link to a copy of an ArrayIntList Java source for this class definition in Module Chapter 15. Please download this as the starting point for your assignment, and add your methods to the class definition, annotating each with a comment that gives the exercise number, just before the code for the method you add. Please see the Rubric HW05 for additional detail. HW05 Criteria Ratings Pts ZIP archive as specified ZIP archive, named as specified, contains one or two source files: one a class definition, the other a test client source. If there is only one source it is the class definition with a source main at the end of it. Nothing else is in 5.0 pts the ZIP archive. Class definition has specified methods inserted The class definition for ArrayIntList, a link for which is in the Module Chapter 15, has the exercise-specified methods edited into it with specified format, i.e., matching the format already present, or as specified in 'Comments and Readability" in Chapter 1 of the text. Each method is preceded by a comment giving the 15.0 pts number of the exercise that specified it. The edited source file has a file header comment block as specified, as has the test client, if present in a separate source file. Methods work as specified Each specified method does what the exercise says it should, as shown by the annotated output of the test 20.0 pts client. Test client exercises all methods The test client supplied with the solution set exercises the specified methods with enough test cases to show that specified results occur. All output is annotated so as to enable a user to see what was tested, and what the 10.0 pts test outcomes were, without reference to the source of the methods.Write a method called lastlndexOf that accepts an integer as a parameter and returns the index in the list of the last occurrence of that value, or 1 if the value is not found in the list. For example, if the list stores [1, 18, 2, 7, 18, 39, 18, 40], then the last index of 18 is 6 and the last index of3 is 1. Write a method called indexOfSubList that accepts another list L as a parameter and returns the starting index of where L first appears in this list, or 1 if it is not found. All elements of L must appear in sequence and in the same order. For example, if variables called list1 and list2 store [11, 7, 3, 42, O, 14] and [3,42, 0], respectively, the call oflist'l.indexOfSubList(list2) should return 2. Write a method called runningTotal that returns a new ArraylntList that contains a running total of the original list. In other words, the ith value in the new list should store the sum of elements 0 through i of the original list. For example, given a variable list that stores [2, 3, 5, 4, 7, 15, 20, 7], consider what happens when the following call is made: ArraylntList list2 = list.runningTotal( ); The variable list2 should store [2, 5, 10, 14, 21, 36, 56, 63]. The original list should not be changed by the method. If the original list is empty, the result should be an empty list. The new list should have the same capacity as the original. Remember that there is a list constructor that accepts a capacity as a parameter. Write a method called count that accepts an element value as a parameter and returns the number of occurrences of that value in the list. For example, suppose a variable named list stores [2, 3, 2, 0, 5, 2, 2, 6]. A call of list.count(2) should return 4 because there are four occurrences of that value in the list. Write a method called removeLast that removes and returns the last value from a list of integers. For example, if a variable called list stores [8, 17, 42. 3, 8], a call of list.removeLast( ); should return 8 and change the lists state to [8, 17, 42, 3]. The next call would return 3 and remove 3 from the list, and so on. If the list is empty, throw a NoSuchElementException

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions