
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
JAVA PROGRAM ASAP
*********** THIS PROGRAM MUST WORK IN HYPERGRADE AND PASS ALL THE TEST CASES.
Sorting - Lab #7
Create a class called Sort that has three static methods for sorting integer arrays. All three methods should accept an array of integers, have void return type, and should sort the array in-place.
1.
public static void bubbleSort(int[] array) {
// your code here
}
2.
public static void insertionSort(int[] array) {
// your code here
}
3.
public static void selectionSort(int[] array) {
// your code here
}
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
3 2 1ENTER
Sorted array using Bubble Sortalgorithm :\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
quitENTER
3 2 1ENTER
Sorted array using Bubble Sort
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
quitENTER
Test Case 2
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1ENTER
Sorted array using Bubble Sort algorithm:\n
1\n
Sorted array using Insertion Sort algorithm:\n
1\n
Sorted array using Selection Sort algorithm:\n
1\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
-100ENTER
Sorted array using Bubble Sort algorithm:\n
-100\n
Sorted array using Insertion Sort algorithm:\n
-100\n
Sorted array using Selection Sort algorithm:\n
-100\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 2ENTER
Sorted array using Bubble Sort algorithm:\n
1 2\n
Sorted array using Insertion Sort algorithm:\n
1 2\n
Sorted array using Selection Sort algorithm:\n
1 2\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
2 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2\n
Sorted array using Insertion Sort algorithm:\n
1 2\n
Sorted array using Selection Sort algorithm:\n
1 2\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 2 3ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
3 2 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
2 3 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 3 2ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
quitENTER
1ENTER
Sorted array using Bubble Sort algorithm:\n
1\n
Sorted array using Insertion Sort algorithm:\n
1\n
Sorted array using Selection Sort algorithm:\n
1\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
-100ENTER
Sorted array using Bubble Sort algorithm:\n
-100\n
Sorted array using Insertion Sort algorithm:\n
-100\n
Sorted array using Selection Sort algorithm:\n
-100\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 2ENTER
Sorted array using Bubble Sort algorithm:\n
1 2\n
Sorted array using Insertion Sort algorithm:\n
1 2\n
Sorted array using Selection Sort algorithm:\n
1 2\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
2 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2\n
Sorted array using Insertion Sort algorithm:\n
1 2\n
Sorted array using Selection Sort algorithm:\n
1 2\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 2 3ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
3 2 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
2 3 1ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 3 2ENTER
Sorted array using Bubble Sort algorithm:\n
1 2 3\n
Sorted array using Insertion Sort algorithm:\n
1 2 3\n
Sorted array using Selection Sort algorithm:\n
1 2 3\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
quitENTER
Test Case 3
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
ENTER
Sorted array using Bubble Sort algorithm:\n
Sorted array using Insertion Sort algorithm:\n
Sorted array using Selection Sort algorithm:\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
QuitENTER
ENTER
Sorted array using Bubble Sort algorithm:\n
Sorted array using Insertion Sort algorithm:\n
Sorted array using Selection Sort algorithm:\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
QuitENTER
Test Case 4
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
0ENTER
Sorted array using Bubble Sort algorithm:\n
0\n
Sorted array using Insertion Sort algorithm:\n
0\n
Sorted array using Selection Sort algorithm:\n
0\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
qUitENTER
0ENTER
Sorted array using Bubble Sort algorithm:\n
0\n
Sorted array using Insertion Sort algorithm:\n
0\n
Sorted array using Selection Sort algorithm:\n
0\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
qUitENTER
Test Case 5
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
1 2 3 10 9 7 8 9 9 9 9 9 1 1 1 1 2 2 2 2 10 10 10 7 7 7 -100ENTER
Sorted array using Bubble Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Sorted array using Insertion Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Sorted array using Selection Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
QUITENTER
1 2 3 10 9 7 8 9 9 9 9 9 1 1 1 1 2 2 2 2 10 10 10 7 7 7 -100ENTER
Sorted array using Bubble Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Sorted array using Insertion Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Sorted array using Selection Sort algorithm:\n
-100 1 1 1 1 1 2 2 2 2 2 3 7 7 7 7 8 9 9 9 9 9 9 10 10 10 10\n
Please enter a space separated list of numbers to sort or type QUIT to exit:\n
QUITENTER
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 5 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- 1- Write a class called items that has member variables name (string), price (double), quantity (integer). In main program, create an array of type items called arrayltem and store several item objects in this array. Note that main should create several item objects and save these objects in arrayltem. Write a static method called totalCost that accepts an array of items. This static method must calculate and return the total cost of items stored in the array. 2- Write a generic method called minimum that accepts four items and find the minimum of them. 3- Test your class with Integer, Double, Character, String and Car objects.arrow_forwardx = 3 + numbers[3]++; System.out.println(x); QUESTION 2: Class Rectangle has two data members, length (type of float) and width (type of float). The class Rectangle also has the following: //mutator methods void setlength (float len) } //B. length = len; H accessor methods float getLength() I return length; The following statement creates an array of Rectangle with size 2: Rectangle[] arrayRectangle= new Rectangle[2]; Is it correct if executing the following statements? What is the output? If it is not correct, write the correct one arrayRectangle. setLength (12.59); System.out.printin[rectangle Set.getLength()); arrayRectangle[1].setLength(4.15); System.out.println(arrayRectangle[1].getLength()): QUESTION 3: Use the following int array int[] numbers = { 42, 28, 36, 72, 17, 25, 81, 65, 23, 58} -Open file data.txt to write. to write the values of the array numbers to the file with the y numbers to get the valuesarrow_forward1) Write a method that returns the range of an array of integers. The range is the difference between the highest and lowest values in the array. The signature of the method should be as follows. public static int computeRange(int[] values)arrow_forward
- JAVA PROGRAM Homework #1. Chapter 7. PC# 2. Payroll Class (page 488-489) Write a Payroll class that uses the following arrays as fields: * employeeId. An array of seven integers to hold employee identification numbers. The array should be initialized with the following numbers: 5658845 4520125 7895122 8777541 8451277 1302850 7580489 * hours. An array of seven integers to hold the number of hours worked by each employee * payRate. An array of seven doubles to hold each employee’s hourly pay rate * wages. An array of seven doubles to hold each employee’s gross wages The class should relate the data in each array through the subscripts. For example, the number in element 0 of the hours array should be the number of hours worked by the employee whose identification number is stored in element 0 of the employeeId array. That same employee’s pay rate should be stored in element 0 of the payRate array. The class should have a method that accepts an employee’s identification…arrow_forward10 Build the Sudoku Reviewer ( the testing program). The specification is below. Please note: you DO NOT have to build a Sudoku solver. To test you just need to build a class that generates a 9x9 2D array with the values you want to test. You can assume the value types are valid. (integers from 1-9). 1-The main purpose is to make sure the Sudoku solver actually solved it correctly! 2- You are also confirming the solver solves puzzle in no longer than a minute 3- Solver (not the reviewer) requires 7 INDICES (ELEMENTS) filled in the input array at least. 4- The reviewer receives both the original puzzle and the solution. The Reviewer needs to confirm the solution is not only a valid SudoKu solution but also the solution to the original puzzle. 5- Solver will return a 2d array filled with -1s if input array has an error/bad input (exception). Reviewer will check for this case.arrow_forwardMethod Details getCountInRange public static int getCountInRange(int[] array, int lower, int upper) Returns the number of values in the range defined by lower (inclusive) and upper (inclusive) Parameters: array - integer array lower - lower limit upper - upper limit Returns: Number of values found Throws: java.lang.IllegalArgumentException - if array is null or lower is greater than upper Any error message is fine (e.g., "Invalid parameters(s)")arrow_forward
- Using jGRASP please de-bug this /**This program demonstrates an array of String objects.It should print out the days and the number of hours spent at work each day.It should print out the day of the week with the most hours workedIt should print out the average number of hours worked each dayThis is what should display when the program runs as it shouldSunday has 12 hours worked.Monday has 9 hours worked.Tuesday has 8 hours worked.Wednesday has 13 hours worked.Thursday has 6 hours worked.Friday has 4 hours worked.Saturday has 0 hours worked.Highest Day is Wednesday with 13 hours workedAverage hours worked in the week is 7.43 hours*/{public class WorkDays{public static void main(String[] args){String[] days = { "Sunday", "Monday", "Tuesday","Wednesday", "Thursday", "Friday", "Saturday"}; int[] hours = { 12, 9, 8, 13, 6, 4}; int average = 0.0;int highest = 0;String highestDay = " ";int sum = 0; for (int index = 0; index < days.length; index++){System.out.println(days[index] + " has "…arrow_forwardData Structure & Algorithm: Show by fully java coded examples how any two sorting algorithms work. You should test these with various array sizes and run them several times and record the execution times. At least four array sizes are recommended. 15, 20, 25, 30. It is recommended you write the classes and then demonstrate/test them using another class. Discuss the comparative efficiencies of your two chosen sorting algorithms.arrow_forwardJava - Gift Exchange *** Please include UML Diagram and notes in code Minimum requirements are: At least 1 loop An Array or ArrayList At least 3 Java classes Use methods I am trying to make it so that the program will: Prompt for the number of people included in exchange - If not even it will state that there has to be an even number and ask for the number of people included again (loops). Prompt to enter a participant's first name Prompt for the participant's age Print out the random matching of participants so that everyone gets a gift and everyone gives a gift. Please include UML Diagramarrow_forward
- Please help with this java problemarrow_forwardJava Netbeansarrow_forwardIn Java Assignment 5B : Maze Game! 2D Arrays can be used to store and represent informationabout video game levels or boards. In this exercise, you will use this knowledge tocreate an interactive game where players attempt to move through a maze. You willstart by creating a pre-defined 2D array with the following values:{"_","X","_","X","X"}{"_","X","_","X","W"}{"_","_","_","X","_"}{"X","X","_","_","_"}{"_","_","_","X","X"}You will then set the player (represented by “O”) at index 0, 0 of the array, the top-leftcorner of the maze. You will use a loop to repeatedly prompt the user to enter adirection (“Left”, “Right”, “Up”, or “Down”). Based on these directions, you will try tomove the player.• If the location is valid (represented by “_”), you will move the player there• If the location is out of bounds (e.g. index 0, -1) or the command is invalid, youwill inform the player and prompt them to enter another direction• If the location is a wall (represented by “X”), you will tell the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education