Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone please do this assignment for me as soon as possible, thank you so much in advance. When writing code with arrays, it is

Can someone please do this assignment for me as soon as possible, thank you so much in advance.

When writing code with arrays, it is important to be able to perform basic operations such as sorting array elements without using pre-built Java methods of an array class. Sorting array elements is the process of ordering and exchanging values. This process is not as straightforward as it may seem, and there are many different ways to sort arrays. When sorting, you must pay close attention to the swapping of data, as it could result in a loss of data. Before you begin coding this application, you may want to consider developing pseudocode to avoid later confusion (review the Arrays video in this weeks course materials).

Submit the following program:

Write a Java program SortArray which defines and use unconstrained array of the integer numbers. The length of the array should be defined by a users input (use Scanner or JOptionPane as an input tool).

When the array length is defined, you will declare the array elements.

Create and call the initializeArray method, which initializes the array with random numbers generated by Java Random class. See Appendix D in the textbook on how to use Java random numbers generator. Keep random numbers in checkany number cannot contain more than three digits.

Create and use the custom method sortDescending to sort the array values in a descending order. Then create and use the custom method sortAscending() to sort the array in an ascending order. Do not use any of the prebuilt sorting methods of the array classsort methods must be implemented by you from scratch using the Bubble Sort algorithm (see the Bubble Sort video in the course resources, in Chapter 9 of the textbook, and the tutorial at https://www.javatpoint.com/bubble-sort-in-java Links to an external site.).

Write a separate displayArray() method that takes the array as an argument and displays the array element values. The first time you will call the array as generated with random numbers. The second time, you will use this method to display descending order array values, and the third time, you will use this method to display ascending order array values.

Make your application user friendly and explain to potential users what they see (i.e., an array of randomly generated values, sorted array values in descending order, sorted array values in ascending order). Format the output in the orderly fashion: initialized array first in a separate line, the descending order array in the next line, then the array in ascending order in the next line.

Add the proper Header to the SortArray.java file. Do not forget to include the proper comments for the code statements in all .java files to explain what those statements do.

Create a UML class diagram of the application illustrating class hierarchy, collaboration, and the content of each class (include as a part of the MS .doc documentation below).

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

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

13-1 How does building new systems produce organizational change?

Answered: 1 week ago