Computers and Technology
Computers and Technology, 14.02.2020 04:49, MeHelp101

Declare an array to hold eight integers. Use a for loop to add eight random integers, all in the range from 50 to 100, inclusive, to this array. Duplicates are okay. Next, pass the array to a method that sorts the array and returns another array containing only the largest and smallest elements in the original array. Print these two values in main. Then use a foreach loop to display all elements of the sorted array on one line separated by a single space. This latter loop should also count the odd and even numbers in the array and determine the sum of all elements in the array. SAMPLE OUTPUT The lowest element is 59 The highest element is 96 Here is the array 59 64 76 77 80 88 91 96 Evens: 5, odds: 3 Total: 631

my code:

I am stuck on the problem to return the highest value and lowest value. Also on sorting the randomly generated integers. All in Java programming.

private static Random rand = new Random();

public static void main(String[] args){
int[] randomEight = numbers();
// printArray(randomEight);
System. out. println("The lowest element is");
System. out. println("The highest element is");
System. out. println("Here is the array");
// System. out. println(Arrays. toString(randomEight));
System. out. println();
for(int i = 0; i System. out. println(randomEight[i] + " ");
}
}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 25.06.2019 00:30, alinton06
What is a typeface? a. a collection of similar text b. a collection of similar fonts c. a collection of similar designs d. a collection of similar colors e. a collection of similar images
Answers: 1
image
Computers and Technology, 25.06.2019 03:00, reearamrup27
Match the categories in the first column with examples in the second column. 1. good for watching movies 2. maximum power with small size 3. older style mobile devices that may or may not have internet connectivity tablet computer a.)pda b.)smart phone c.)tablet computer
Answers: 1
image
Computers and Technology, 25.06.2019 04:10, val926
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
image
Computers and Technology, 25.06.2019 04:40, hazeleyes2006
Ineed ! i need a computer whiz to me complete my study guide on computers, it's 50 questions. if anyone can me i'll be greatly appreciated.
Answers: 1
Do you know the correct answer?
Declare an array to hold eight integers. Use a for loop to add eight random integers, all in the ran...

Questions in other subjects:

Konu
Mathematics, 26.05.2021 05:10