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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section7.4: Arrays As Arguments
Problem 7E: (Statistics) Write a program that includes two functions named calcavg() and variance(). The...
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
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,