Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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; iimage text in transcribedimage text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

c. What were you expected to do when you grew up?

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago

Question

e. What do you know about your ethnic background?

Answered: 1 week ago