Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 12, Problem 3P
Repeat Practice Program 1, but instead write a method insertionSort that performs an insertion sort, as described in
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
WITHOUT USING VECTOR ARRAY. Using c++ . Write different code rather than 2 codes that already existed in this question on this website.
in c++
Using C++
Chapter 12 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 12.1 - Suppose aList is an object of the class...Ch. 12.1 - Prob. 2STQCh. 12.1 - Prob. 3STQCh. 12.1 - Prob. 4STQCh. 12.1 - Can you use the method add to insert an element at...Ch. 12.1 - Prob. 6STQCh. 12.1 - Prob. 7STQCh. 12.1 - If you create a list using the statement...Ch. 12.1 - Prob. 9STQCh. 12.1 - Prob. 11STQ
Ch. 12.1 - Prob. 12STQCh. 12.2 - Prob. 13STQCh. 12.2 - Prob. 14STQCh. 12.2 - Prob. 15STQCh. 12.2 - Prob. 16STQCh. 12.3 - Prob. 17STQCh. 12.3 - Prob. 18STQCh. 12.3 - Prob. 19STQCh. 12.3 - Write a definition of a method isEmpty for the...Ch. 12.3 - Prob. 21STQCh. 12.3 - Prob. 22STQCh. 12.3 - Prob. 23STQCh. 12.3 - Prob. 24STQCh. 12.3 - Redefine the method getDataAtCurrent in...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.3 - Repeat Question 25 for the method...Ch. 12.4 - Revise the definition of the class ListNode in...Ch. 12.4 - Prob. 30STQCh. 12.5 - What is the purpose of the FXML file?Ch. 12.5 - Prob. 32STQCh. 12 - Repeat Exercise 2 in Chapter 7, but use an...Ch. 12 - Prob. 2ECh. 12 - Prob. 3ECh. 12 - Repeat Exercises 6 and 7 in Chapter 7, but use an...Ch. 12 - Write a static method removeDuplicates...Ch. 12 - Write a static method...Ch. 12 - Write a program that will read sentences from a...Ch. 12 - Repeat Exercise 12 in Chapter 7, but use an...Ch. 12 - Write a program that will read a text file that...Ch. 12 - Revise the class StringLinkedList in Listing 12.5...Ch. 12 - Prob. 12ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 14ECh. 12 - Write some code that will use an iterator to...Ch. 12 - Prob. 17ECh. 12 - Revise the method selectionSort within the class...Ch. 12 - Repeat the previous practice program, but instead...Ch. 12 - Repeat Practice Program 1, but instead write a...Ch. 12 - Write a program that allows the user to enter an...Ch. 12 - Write a program that uses a HashMap to compute a...Ch. 12 - Write a program that creates Pet objects from data...Ch. 12 - Repeat the previous programming project, but sort...Ch. 12 - Repeat the previous programming project, but read...Ch. 12 - Prob. 9PPCh. 12 - Prob. 10PPCh. 12 - Prob. 11PPCh. 12 - Prob. 12PPCh. 12 - Prob. 13PPCh. 12 - Prob. 14PPCh. 12 - Prob. 15PP
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Use the following tables for your answers to questions 3.7 through 3.51 : PET_OWNER (OwnerID, OwnerLasst Name, ...
Database Concepts (8th Edition)
What is the output of the following two lines of Java code?
Absolute Java (6th Edition)
Describe a method that can be used to gather a piece of data such as the users age.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Consider the following code (and assume that it is embedded in a complete and correct program and then run): st...
Problem Solving with C++ (10th Edition)
T F: A named constants value can be changed by a programming statement while the program is running.
Starting Out With Visual Basic (8th Edition)
What do the Ada and COBOL languages have in common?
Concepts of Programming Languages (11th Edition)
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
- Use C#. Chapter 6 discussed the predefined IndexOf() method of an array; the method takes two parameters, the whole array and an element to search. The method returns the index of the element if found, and -1 if not found. Now, you are asked to write a program that has a method FindMatch() that does exactly the same thing: 1) The Main() calls FindMatch(). 2) FindMatch() takes two parameters: 1) the whole array of integer test scores { 85, 98, 100, 73, 67, 82, 92, 87 }, and 2) an element to search from users input. 3) FindMatch() returns the index of element if found back to the Main(), and -1 if not found. The method should not use IndexOf() to do the search. 4) The program displays either the index or -1 in the Main(). Sample output (from Microsoft Visual Studio) as shown belowarrow_forward12. You have written a sorting method that takes an array of Object as its parameter. What limitations are imposed on the users of this method?arrow_forwardI need the code from start to end with no errors and the explanation for the code ObjectivesJava refresher (including file I/O)Use recursionDescriptionFor this project, you get to write a maze solver. A maze is a two dimensional array of chars. Walls are represented as '#'s and ' ' are empty squares. The maze entrance is always in the first row, second column (and will always be an empty square). There will be zero or more exits along the outside perimeter. To be considered an exit, it must be reachable from the entrance. The entrance is not an exit.Here are some example mazes:mazeA7 9# # ###### # # ## # # #### # ## ##### ## ########## RequirementsWrite a MazeSolver class in Java. This program needs to prompt the user for a maze filename and then explore the maze. Display how many exits were found and the positions (not indices) of the valid exits. Your program can display the valid exits found in any order. See the examples below for exact output requirements. Also, record…arrow_forward
- give typed code and compiler screenshot with outputarrow_forward1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or byentering the string “quit”. 2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For example, if the list contains the following names: Charles Darwin Albert Einstein Issac Newton Tony Hoare Grace Hopper Edgar Dijkstra Ada Lovelace Charles Babbage Stephen Hawking Your program should output:The first name in the list in alphabetical order is: Ada Lovelace The last name in the list in alphabetical order is: Tony Hoarearrow_forwarddo in javaarrow_forward
- Write a program that first reads an integer for the array size, then reads numbers intothe array, and finally outputs how many numbers have values that are greater than theaverage. For practice reasons, try not to use the index notation of arrays (e.g. myarray[i])at all. Use pointers instead.arrow_forwardQ1. Produce a method that reads in a set of values (double) from the user and returns them. Use this header: public static double[] getNumsFromUser (String msg1, String msg2) The implementation of the method should start with a message to input the total number of array elements, followed by a message to enter all the array elements. The method returns the array of elements. The two strings msg1 and msg2 that are passed to the method as parameters will be the two messages that tell the user what to do. In the main class, use the following program outline to test this method: public class Q1 { public static void main(String[] args) { String s1 = "Enter number of students: "; String s2 = "Enter student grades: "; double[] numbers = getNumsFromUser(s1, s2); System.out.println(Arrays.toString(numbers)); public static double[] getNumsFromUser(String msg1, String msg2){ //your code goes here } Sample run Enter number of students: 4 Enter student grades: 12.5 23 11.5 27 [12.5, 23.0, 11.5,…arrow_forwardWrite a Java program that uses ArrayList and Iterator. It should input from user the names and ages of your few friends in a loop and add into ArrayList. Finally, it should use an Iterator to display the data in a proper format. ( Sample run of the program:-) List of my Friends Enter name and age [friend# 0] Khalid Al-shamri 22.5 Do you want to add another friend (y/n)? y Enter name and age [friend# 1] Rahsed Al-anazi 21.1 Do you want to add another friend (y/n)? y Enter name and age [friend# 2] Salem Al-mutairi 23.7 Do you want to add another friend (y/n)? n Here is the data you entered: 0. Khalid Al-shamri, 22.5 1. Rahsed Al-anazi, 21.1 2. Salem Al-mutairi, 23.7arrow_forward
- in c++, use parallel arrays , and srand(time(NULL)) to randomize the two cards dealt at the start Create a Blackjack (21) game. Your version of the game will imagine only a SINGLE suit of cards, so 13 unique cards, {2,3,4,5,6,7,8,9,10,J,Q,K,A}. Upon starting, you will be given two cards from the set, non-repeating. Your program MUST then tell you the odds of receiving a beneficial card (that would put your value at 21 or less), and the odds of receiving a detrimental card (that would put your value over 21). Recall that the J, Q, and K cards are worth ‘10’ points, the A card can be worth either ‘1’ or ‘11’ points, and the other cards are worth their numerical values.arrow_forwardb. Problem 2. Again, create an array of 30 random numbers that range between 1 and 100. And again, write a function that will receive a number from the user and determine if that number exists in the array or not. Approach: This time, implement a method called findB(x,A), where x is the number we are looking for and A is an array. In the body of the function, compare x with the MIDDLE item that is in the array. If this item is equal to X, return true. If not, divide A into TWO lists as follows: Call the middle of index of the array mid. Place items at indices mid+1 to A.length-1 in one array and call it A1. Place items at indices 0 to mid (excluding mid) in an array called A2. Then, recursively call findB(x,Al) and findB(x,A2). If you call find on an empty list, you will want to return false. Writing any explicit loop in your code results a 0 for this question. Remember to provide pre- and post-conditions. How many recursive calls will you need to search the entire list? Do you think…arrow_forwardComplete the implementation of scrabble.c, such that it determines the winner of a short scrabble-like game, where two players each enter their word, and the higher scoring player wins. Notice that we’ve stored the point values of each letter of the alphabet in an integer array named POINTS. For example, A or a is worth 1 point (represented by POINTS[0]), B or b is worth 3 points (represented by POINTS[1]), etc. Notice that we’ve created a prototype for a helper function called compute_score() that takes a string as input and returns an int. Whenever we would like to assign point values to a particular word, we can call this function. Note that this prototype is required for C to know that compute_score() exists later in the program. In main(), the program prompts the two players for their words using the get_string() function. These values are stored inside variables named word1 and word2. In compute_score(), your program should compute, using the POINTS array, and return the score…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License