PLease use java 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. Each method has been defined for you, but without the code. See the javadoc for each method for instructions on what the method is supposed to do and how to write the code. It should be clear enough. In some cases, we have provided hints and example method calls to help you get started. For example, we have defined a “howMany” method for you (see below) which counts and returns the number of occurrences of a given element in a given array. For now, the method returns a 0 value as a placeholder. Read the javadoc, which explains what the method is supposed to do. Then write your code where it says “// TODO” to implement the method. You’ll do this for each method in the program. /** * Counts the number of occurrences of the given element in the given array. * @param array to search * @param element to search for * @return number of times element is in array */ public int howMany(int[] array, int element) { // TODO Implement method return 0; } In addition, you will write unit tests to test your method implementations. Each unit test method has been defined for you, including some test cases. First make sure you pass all of the provided tests, then write additional and distinct test cases for each unit test method. For example, we have defined a “testHowMany” method for you (see below) which tests the “howMany” method. Pass the tests provided then write additional tests where it says “// TODO”. You’ll do this for each unit test method in the program. /** * Test howMany method in ArrayAndArrayList. */ @Test void testHowMany() { // element in the array int[] array = {1, 3, 5, 7, 9, 1, 2, 3, 4, 5}; assertEquals(2, this.myArrayAndArrayList.howMany(array, 1)); // TODO write at least 3 additional test cases }  You have been provided with ArrayAndArrayList.java and ArrayAndArrayListTest.java. To complete the assignment, implement the methods in ArrayAndArrayList.java, making sure you pass all the tests in ArrayAndArrayListTest.java. Then write at least 3 additional and distinct test cases for each unit test method in ArrayAndArrayListTest.java. Do not modify the name of the methods in ArrayAndArrayList.java or the automated testing will not recognize it. You will submit two files for this assignment: ArrayAndArrayList.java and ArrayAndArrayListTest.java. Make sure your program and the unit testing files run without errors!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

PLease use java

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.
Each method has been defined for you, but without the code. See the javadoc for each method
for instructions on what the method is supposed to do and how to write the code. It should be
clear enough. In some cases, we have provided hints and example method calls to help you
get started.
For example, we have defined a “howMany” method for you (see below) which counts and
returns the number of occurrences of a given element in a given array. For now, the method
returns a 0 value as a placeholder. Read the javadoc, which explains what the method is supposed to do. Then write your code where it says “// TODO” to implement the method.
You’ll do this for each method in the program.
/**
* Counts the number of occurrences of the given element in the given
array.
* @param array to search
* @param element to search for
* @return number of times element is in array
*/
public int howMany(int[] array, int element) {
// TODO Implement method
return 0;
}
In addition, you will write unit tests to test your method implementations. Each unit test
method has been defined for you, including some test cases. First make sure you pass all of
the provided tests, then write additional and distinct test cases for each unit test method.
For example, we have defined a “testHowMany” method for you (see below) which tests the
“howMany” method. Pass the tests provided then write additional tests where it says “//
TODO”. You’ll do this for each unit test method in the program.
/**
* Test howMany method in ArrayAndArrayList.
*/
@Test
void testHowMany() {
// element in the array
int[] array = {1, 3, 5, 7, 9, 1, 2, 3, 4, 5};
assertEquals(2, this.myArrayAndArrayList.howMany(array, 1));
// TODO write at least 3 additional test cases

You have been provided with ArrayAndArrayList.java and ArrayAndArrayListTest.java. To
complete the assignment, implement the methods in ArrayAndArrayList.java, making sure you
pass all the tests in ArrayAndArrayListTest.java. Then write at least 3 additional and distinct
test cases for each unit test method in ArrayAndArrayListTest.java. Do not modify the name
of the methods in ArrayAndArrayList.java or the automated testing will not recognize it.
You will submit two files for this assignment: ArrayAndArrayList.java and
ArrayAndArrayListTest.java. Make sure your program and the unit testing files run without
errors! 

You have been provided with ArrayAndArrayList.java and ArrayAndArrayListTestjava. To
complete the assignment, implement the methods in ArrayAndArrayList.java, making sure you
pass all the tests in ArrayAndArrayListTest.java. Then write at least 3 additional and distinct
test cases for each unit test method in ArrayAndArrayListTest.java. Do not modify the name
of the methods in ArrayAndArrayList.java or the automated testing will not recognize it.
You will submit two files for this assignment: ArrayAndArrayList.java and
ArrayAndArrayListTestjava. Make sure your program and the unit testing files run without
errors! Submit the completed program using the steps outlined in the assignment in Coursera.
Transcribed Image Text:You have been provided with ArrayAndArrayList.java and ArrayAndArrayListTestjava. To complete the assignment, implement the methods in ArrayAndArrayList.java, making sure you pass all the tests in ArrayAndArrayListTest.java. Then write at least 3 additional and distinct test cases for each unit test method in ArrayAndArrayListTest.java. Do not modify the name of the methods in ArrayAndArrayList.java or the automated testing will not recognize it. You will submit two files for this assignment: ArrayAndArrayList.java and ArrayAndArrayListTestjava. Make sure your program and the unit testing files run without errors! Submit the completed program using the steps outlined in the assignment in Coursera.
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.
Each method has been defined for you, but without the code. See the javadoc for each method
for instructions on what the method is supposed to do and how to write the code. It should be
clear enough. In some cases, we have provided hints and example method calls to help you
get started.
For example, we have defined a "howMany" method for you (see below) which counts and
returns the number of occurrences of a given element in a given array. For now, the method
returns a 0 value as a placeholder. Read the javadoc, which explains what the method is
Penn
Engineering
ONLINE LEARNING
Introduction to Java & Object Oriented Programming
supposed to do. Then write your code where it says "// TODO" to implement the method.
You'll do this for each method in the program.
/**
Counts the number of occurrences of the given element in the given
array.
* @param array to search
* @param element to search for
* @return number of times element is in array
* /
public int howMany(int[] array, int element) {
// TODO Implement method
return 0;
In addition, you will write unit tests to test your method implementations. Each unit test
method has been defined for you, including some test cases. First make sure you pass all of
the provided tests, then write additional and distinct test cases for each unit test method.
For example, we have defined a "testHowMany" method for you (see below) which tests the
"howMany" method. Pass the tests provided then write additional tests where it says "//
TODO". You'll do this for each unit test method in the program.
/**
* Test howMany method in ArrayAndArrayList.
* /
@Test
void testHowMany () {
// element in the array
int [] array = {1, 3, 5, 7, 9, 1, 2, 3, 4, 5};
assertEquals (2, this.myArrayAndArrayList.howMany (array, 1) ) ;
// TODO write at least 3 additional test cases
}
Transcribed Image Text: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. Each method has been defined for you, but without the code. See the javadoc for each method for instructions on what the method is supposed to do and how to write the code. It should be clear enough. In some cases, we have provided hints and example method calls to help you get started. For example, we have defined a "howMany" method for you (see below) which counts and returns the number of occurrences of a given element in a given array. For now, the method returns a 0 value as a placeholder. Read the javadoc, which explains what the method is Penn Engineering ONLINE LEARNING Introduction to Java & Object Oriented Programming supposed to do. Then write your code where it says "// TODO" to implement the method. You'll do this for each method in the program. /** Counts the number of occurrences of the given element in the given array. * @param array to search * @param element to search for * @return number of times element is in array * / public int howMany(int[] array, int element) { // TODO Implement method return 0; In addition, you will write unit tests to test your method implementations. Each unit test method has been defined for you, including some test cases. First make sure you pass all of the provided tests, then write additional and distinct test cases for each unit test method. For example, we have defined a "testHowMany" method for you (see below) which tests the "howMany" method. Pass the tests provided then write additional tests where it says "// TODO". You'll do this for each unit test method in the program. /** * Test howMany method in ArrayAndArrayList. * / @Test void testHowMany () { // element in the array int [] array = {1, 3, 5, 7, 9, 1, 2, 3, 4, 5}; assertEquals (2, this.myArrayAndArrayList.howMany (array, 1) ) ; // TODO write at least 3 additional test cases }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY