Question: I am getting an error when submitting that I need an indent at the end. How do I add this indent or space? Here is
I am getting an error when submitting that I need an indent at the end. How do I add this indent or space?
Here is what I have so far -
// Java program // Scanner class for input import java.util.Scanner; // Class declaration public class LabProgram { // Method declaration public static void sortArray(int[] myArr, int arrSize){ // Outer loop for (int i = 0; i
// Input array elements for(int i=0; i

Define a method named sortArray that takes an array of integers and the number of elements in the array as parameters. Method sortArray () modifies the array parameter by sorting the elements in descending order (highest to lowest). Then write a main program that reads a list of integers from input, stores the integers in an array, calls sortArray(0, and outputs the sorted array. The first input integer indicates how many numbers are in the list. Assume that the list will always contain less than 20 integers. Ex: If the input is: 510439122 the output is: 39,12,10,4,2, For coding simplicity, follow every output value by a comma, including the last one. Your program must define and call the following method: public static void sortArray(int[] myArr, int arrSize) Hint: Sorting an array can be done in many ways. You are welcome to look up and use any existing algorithm. Some believe the simplest to code is bubble sort: https://en.wikipedia.org/wiki/Bubble_sort. But you are welcome to try others: https://en.wikipedia.org/wiki/Sorting_algorithm. 438042.2388000.q3zqy7 2:Compare output 0/3 Output is nearly correct, but whitespace differs. See highlights below. Input Your output Expected output 4:Unit test sortArray([699022])
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
