Question: I need some help doing this java program. This is the MyArrayList code, and below is everything needed to run it. /* * To change

I need some help doing this java program.

I need some help doing this java program. This is the MyArrayList

This is the MyArrayList code, and below is everything needed to run it.

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package collection;

/* * @This program clones an array * * */

public class MyArrayList implements Cloneable{ public Object[] obj; public int maxsize = 100,initialsize = 0; public MyArrayList(){ obj = new Object[maxsize]; } public void append(Object element){ if(initialsize index;i--){ obj[i] = obj[i-1]; } obj[index] = element; } public boolean isEmpty(){ if(initialsize == 0) return true; return false; } public void removedAt(int index){ for(int i=index;i= minCapacity) return true; return false; } public Object clone() throws CloneNotSupportedException{ return super.clone(); } public void removeRange(int fromIndex,int toIndex){ for(int i=fromIndex;i

Lab 2 Program

package lab;

import collection.MyArrayList;

/* * @This program clones an array * @author jgemerick0 * @version 2020.20.2 */ public class Lab2{ public static void test(String[] cmd) throws CloneNotSupportedException { MyArrayList list = new MyArrayList(); list.append(0); list.append(2); int one = 0,two =1; for(int i=0;i

}.

This the main to class.

package main;

import lab.Lab2;

/** * @This program prints a clone of another array * @author jgemerick0 * * @version 2020.20.2 */ public class Main { public static void main(String[] args) throws CloneNotSupportedException { Lab2.test(args); } }

1. Implement the MySort class with the following operations. a bubbleSort( M ArrayList arraylist) - conduct bubble sort on the elements contained in a My ArrayList object. b. selectionSort(MyArrayList arraylist) - conduct selection sort on the elements contained in a MyArrayList object. 2. Implement the MySearch class with the following operations. a. binary Search (MyArrayList arraylist, Comparable target) - conduct binary search on sorted elements contained in a MyArrayList object. b. linear SearchSorted (MyArrayList arraylist, Comparable target) - conduct linear search on sorted elements contained in a MyArrayList object. 3. Both the MySearch and MySort classes should be created in the collection package. 4. After implementing the My Search and MySort classes you will test them. To test the MySearch and MySort classes you will create a Lab3 class under the lab package. 5. In the Lab3 class you will create an static void test() method. In this test method you will do the following: a. Create a numArraplist of MyArrayList type. b. Generate a sequence of 800 integer numbers in the range (100.999] using java.util. Random with current system time as the random seed (use java.lang. System.nanoTime()). Insert this sequence of numbers into num4rraylist one by one when it is being generated. C. Sort numArraylist using bubbleSort. d. Print out numArraylist onto the screen. e. Prompt user to type in a number through keyboard. f. Search that number using linear SearchSorted, and print out the returned value onto screen. g. Call numArraylist.removeRange(50, 650). h. Then call mumArraylist.reverse(). i. Sort numArraylist using selectionSort. j. Print out numArraylist onto the screen k. Prompt user to type in a number through keyboard. 1. Search that number using binary Search, and print out the returned value onto screen. 6. Under the main package, in the Main class. remove or comment it out) the contents of the main method we have added in the last lab (or project) and do the following: Lab3.test()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!