Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: In the QuizMethods.java class create the following 2 static methods: a method that takes an array of integers as a parameter and returns

image text in transcribed

image text in transcribed

Part 1: In the QuizMethods.java class create the following 2 static methods: a method that takes an array of integers as a parameter and returns true if all the integers in the array are even and returns false otherwise. Checks an array of integers to see if all elements of the array are even. @param data an array of integers to check @return true if the array contains only even numbers; false otherwise */ public static boolean checkAllEven (int[] data) { AND a method that takes as parameters an array of integers and an integer and returns the number of times that integer occurs in the array of integers. * Given an array of integers and an integer, return how many occurrences of the integer appear in the array. * @param data an array of integers Gparam target an integer to search for in the array * @return number of times target appears in data public static int countOccurrences (int[] data, int target) Part 2: In the class called Quiz6Main java you will only need a main() method. In the main() method create an int array and put some numbers into the array. For example, maybe you will create your array as follows: int[] myArray = {42, 2, 13, 2, 7, 99, 142}; Next, print your array You will then pass this array to the 2 methods which you will create in the Quiz6Methods.java class. The methods in QuizMethods.java will return results back to main(and you should then print those results. Make sure that your program output is labeled clearly. For example, your program output might look like the output shown below: The array : [42, 2, 13, 2, 7, 99, 142] All even: false The number 2 occu ccurs 2 times in this array. Here is another test of the program: The array : [42, 2, 4, 8, 1421 All even: The number 15 occurs 0 times in this array. true

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

More Books

Students also viewed these Databases questions