This project was for implementing Arrays and ArrayLists in java, while studying a java object oriented programming course.
In this assignment, you will implement a class called ArrayAndArrayList . This class includes some interesting methods for working with Arrays and ArrayLists.
For example, the ArrayAndArrayList class has a “findMax” method which finds and returns the max number in a given array. For a defined array: int[] array = {1, 3, 5, 7, 9}, calling findMax(array) will return 9.
There are 4 methods that need to be implemented in the ArrayAndArrayList class:
- howMany(int[] array, int element) - Counts the number of occurrences of the given element in the given array.
- findMax(int[] array) - Finds the max number in the given array.
- maxArray(int[] array) - Keeps track of every occurrence of the max number in the given array.
- swapZero(int[] array) - Puts all of the zeros in the given array, at the end of the given array. The method updates the array itself
you can find the script right here on this repository
Format:
- Main code for being run
- Output
A.
B.
C.
D.