Java - Functions with 1D Arrays Create a program that asks the user for the size of an integer array and the elements of the array.   Then, create a function called maxArray() with the following details: Parameters: An integer array The size of the integer array Return type - int Return value - the maximum value of the integer array   Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards. Input 1. First line contains the size of the array 2. Succeeding lines are the elements of an array 3. First line contains the size of the array 4. Succeeding lines are the elements of an array 5. First line contains the size of the array 6. Succeeding lines are the elements of an array 7. First line contains the size of the array 8. Succeeding lines are the elements of an array Output Enter size of array: 5 Enter element 1: 1 Enter element 2: 2 Enter element 3: 3 Enter element 4: 4 Enter element 5: 5 Maximum element: 5

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

Java - Functions with 1D Arrays

Create a program that asks the user for the size of an integer array and the elements of the array.

 

Then, create a function called maxArray() with the following details:

  • Parameters:
    • An integer array
    • The size of the integer array
  • Return type - int
  • Return value - the maximum value of the integer array

 

Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards.

Input

1. First line contains the size of the array

2. Succeeding lines are the elements of an array

3. First line contains the size of the array

4. Succeeding lines are the elements of an array

5. First line contains the size of the array

6. Succeeding lines are the elements of an array

7. First line contains the size of the array

8. Succeeding lines are the elements of an array

Output

Enter size of array: 5
Enter element 1: 1
Enter element 2: 2
Enter element 3: 3
Enter element 4: 4
Enter element 5: 5
Maximum element: 5
2. Functions with ID Arrays Practice II
by CodeChum Admin
Create a program that asks the user for the size of an integer array and the elements of the
array.
Then, create a function called maxArray() with the following details:
. Parameters:
An integer array
The size of the integer array
. Return type - int
. Return value - the maximum value of the integer array
Call the function you created in the main and pass the integer array and its size to it. Make
sure to store the return value in a variable so you could print it afterwards.
Input
1. First line contains the size of the array
2. Succeeding lines are the elements of an array
3. First line contains the size of the array
4. Succeeding lines are the elements of an array
5. First line contains the size of the array
6. Succeeding lines are the elements of an array
7. First line contains the size of the array
8. Succeeding lines are the elements of an array
Output
Main.java
*
Java
Test Cases
Constraints
O Constraint 1
The code must contain a function called maxArray
O Constraint 2
The code must have a function called maxArray
Test Cases
O Test Case 1
Your Output
No Output
Expected Output
Enter size of array: 8
Enter element 1: 936
Enter element 2: 439
Enter element 3: 601
Enter element 4: 853
Enter element 5: 204
Enter element 6: 215
Enter element 7: 708
Enter element 8: 914
Maximum element: 936
Show Differences &
Transcribed Image Text:2. Functions with ID Arrays Practice II by CodeChum Admin Create a program that asks the user for the size of an integer array and the elements of the array. Then, create a function called maxArray() with the following details: . Parameters: An integer array The size of the integer array . Return type - int . Return value - the maximum value of the integer array Call the function you created in the main and pass the integer array and its size to it. Make sure to store the return value in a variable so you could print it afterwards. Input 1. First line contains the size of the array 2. Succeeding lines are the elements of an array 3. First line contains the size of the array 4. Succeeding lines are the elements of an array 5. First line contains the size of the array 6. Succeeding lines are the elements of an array 7. First line contains the size of the array 8. Succeeding lines are the elements of an array Output Main.java * Java Test Cases Constraints O Constraint 1 The code must contain a function called maxArray O Constraint 2 The code must have a function called maxArray Test Cases O Test Case 1 Your Output No Output Expected Output Enter size of array: 8 Enter element 1: 936 Enter element 2: 439 Enter element 3: 601 Enter element 4: 853 Enter element 5: 204 Enter element 6: 215 Enter element 7: 708 Enter element 8: 914 Maximum element: 936 Show Differences &
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Arrays
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
  • SEE MORE 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