Write a main method to test the above methods as follows: Declare and initialize 2 integer arrays (arrayA and arrayB) of size 5 (fill the 2 arrays with random integers between 1 and 100). Inveke the method printArray to display the values stored in the two arrays. Invoke the method checkArays and pass to it the two arrays arrayA and arrayB. Invoke the method printArray to display the values of the new array (arrayC).

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Write a method called checkArrays that accepts as parameters two arrays of integer (A
and B of the same size) and returns another array of integers (C) initialized as follows: C[i] = 1
if B(i] divides A[i], otherwise C[i] = 0. For example:
A 12
20
4 30 17
B 36 24 15
Using java
1
1
Use the following method header:
public static int ) checkArrays (int A. int[ ) E)
+Write a void method called printArray that accepts as parameters an array of integers and
print its values. Use the following method header:
public static void printArray (int ( 1 arr)
Write a main method to test the above methods as follows:
- Declare and initialize 2 integer arrays (arrayA and arrayB) of size 5 (fill the 2 arrays with random
integers between 1 and 100).
- Invoke the method printArray to display the values stored in the two arrays.
- Invoke the method checkArrays and pass to it the two arrays arrayA and arrayB.
- Invoke the method printArray to display the values of the new array (arrayC).
Sample Run:
ArrayA: 12
20
30
17
ArrayB:
24
15
Arrayc: 1
1
Transcribed Image Text:Write a method called checkArrays that accepts as parameters two arrays of integer (A and B of the same size) and returns another array of integers (C) initialized as follows: C[i] = 1 if B(i] divides A[i], otherwise C[i] = 0. For example: A 12 20 4 30 17 B 36 24 15 Using java 1 1 Use the following method header: public static int ) checkArrays (int A. int[ ) E) +Write a void method called printArray that accepts as parameters an array of integers and print its values. Use the following method header: public static void printArray (int ( 1 arr) Write a main method to test the above methods as follows: - Declare and initialize 2 integer arrays (arrayA and arrayB) of size 5 (fill the 2 arrays with random integers between 1 and 100). - Invoke the method printArray to display the values stored in the two arrays. - Invoke the method checkArrays and pass to it the two arrays arrayA and arrayB. - Invoke the method printArray to display the values of the new array (arrayC). Sample Run: ArrayA: 12 20 30 17 ArrayB: 24 15 Arrayc: 1 1
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education