Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

_____________________________________________________________________________ ArrayPlay.java : import java.util.*; /* * This program checks if an array is sorted. * An unsorted array is sorted in ascending order. *

image text in transcribed

_____________________________________________________________________________

ArrayPlay.java :

import java.util.*; /* * This program checks if an array is sorted. * An unsorted array is sorted in ascending order. * An array in ascending order is left unchanged. * An array in descending order is reversed. * * @creator gdt * @created 02017.12.15 * @assignment implement the checkIfSorted() * and reverseArray() methods */ public class ArrayPlay { // checkIfSorted() return values... private static final int UNSORTED = 0; private static final int ASCENDING = 1; private static final int DESCENDING = 2; public static void main(String[] argv) { int[][] data = { { 7, 7, 3, 9, 0, 5, 6 }, { 9, 8, 8, 5, 3, 0 }, { 1, 5, 6, 6, 6, 7, 9 }, { 1, 9, 3, 5, 2, 7, 3, 5 }, { 0 }, { 1, 2 }, { 3, 2, 1 }, { 5, 5, 5, 5, 5 }, }; for (int i = 0; i  

_____________________________________________________________________________

Desired outcome in plain text:

[7,7,3,9,0,5,6] (not sorted) [0,3,5,6,7,7,9] [9,8,8,5,3,0] (descending sorted order) [0,3,5,8,8,9] [1,5,6,6,6,7,9] (ascending sorted order) [1,9,3,5,2,7,3,5] (not sorted) [1,2,3,3,5,5,7,9] [0] (ascending sorted order) [1,2] (ascending sorted order) [3,2,1] (descending sorted order) [1,2,3] [5,5,5,5,5] (ascending sorted order) 
Specification Copy the program ArrayPlay.iava to your computer and implement the methods named checklfSorted() and reverse(). The TBI (To Be Implemented) method comment blocks document what the methods do The output of the program must match the following [7,7,3,9,0,5,6] (not sorted) [0,3,5,6,7,7,91 [9,8,8,5,3,0] (descending sorted order) [0,3,5,8,8,9] [1,5,6,6,6,7,9 (ascending sorted order) [1,9,3,5,2,7,3,5] (not sorted) [1,2,3,3,5,5,7,9] [0 (ascending sorted order) [1,2 (ascending sorted order) [3,2,1] (descending sorted order) [1,2,3] [5,5,5,5,5] (ascending sorted order)

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

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions