Many Things, <span>Easy World of English,
</span><span>Dave's ESL Cafe
</span>,<span>BBC Learning English</span>
Answer:
import java.util.Arrays;
import java.util.Scanner;
public class LatinHire {
public static void main(String[] args) {
Scanner in = new Scanner (System.in);
System.out.println("Enter Five integers");
int num1 = in.nextInt();
int num2 = in.nextInt();
int num3 = in.nextInt();
int num4 = in.nextInt();
int num5 = in.nextInt();
int [] intArray = {num1,num2,num3,num4,num5};
System.out.println(Arrays.toString(intArray));
System.out.println("The Maximum is "+returnMax(intArray));
System.out.println("The Minimum is "+returnMin(intArray));
}
public static int returnMax(int []array){
int max = array[0];
for(int i=0; i<array.length; i++){
if(max<array[i]){
max= array[i];
}
}
return max;
}
public static int returnMin(int []array){
int min = array[0];
for(int i=0; i<array.length; i++){
if(min>array[i]){
min= array[i];
}
}
return min;
}
}
Explanation:
- This is implemented in Java Programming Language
- Two Methods are created returnMax(Returns the Maximum Value of the five numbers) and returnMin(Returns the minimum of the five numbers)
- In the Main method, the user is prompted to enter five numbers
- The five numbers are saved into an array of integers
- The returnMax and returnMin methods are called and passed the array as parameter.
- The entire array of numbers inputted by the user as well the Max and Min are printed
Answer:
The correct answer to this question is option (a).
Explanation:
In the programming language (java) the syntax for declaring,initializing single denominational array can be given as:
Syntax:
datatype array[] arrayname; // declare the array
Example: int [] a;
a = new int[5]; // create the array
int [] n ={2,5,7,9,3}; // initialize all elements
Or
a[0] = 2;
a[1] = 22;
a[2] = 12;
a[3] = 20;
a[4] = 23;
In the above we define the way to initialize the array. So the correct way to set array element is option (a).
Is this a question or you mean you wish you could give people 1,000 points?