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 9E
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that uses an object of type ServiceRequests to keep track of customers that have called. It should have a loop that, in each iteration, attempts to add a name, remove a name, or print all names. Use an array of size 10 as the list of names.
1. Copy some text from a news article, paste it in the Notepad++ editor and save it in a textfile named testtext.txt;2. Write a Java program to read the words in the text file into an ArrayList object,display the information about how many words there are in the text file, and display thewords in the order they appear in the text file. Then sort the array and display the sortedarray. Take a screenshot of the output window.3. Submit your text file, the screenshot, and the Java source code file
Implement one of the sorts described in Chapters 15 and 16. Input is an array with at least 10 items. The items in the
array can be of several types (Suggested types are integers-denoting how many customers visited the store in the last
three weeks or strings-denoting the names of featured items). The items should be connected to a store in some way.
Use some of the given data fields
Print a title indicating what the data represents. Print the original data, AND the sorted data.
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
The ____________ is always transparent.
Web Development and Design Foundations with HTML5 (8th Edition)
Describe the purpose of the access key attribute and how it supports accessibility.
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Show a snippet of PHP code for disconnecting from the database. Explain the meaning of the code.
Database Concepts (7th Edition)
Practice Problem 2.54 (solution page 160) Assume variables x, f, and d are of type int, float, and double, resp...
Computer Systems: A Programmer's Perspective (3rd Edition)
3.12 (Date Create a class called Date that includes three pieces Of information as data
members—a month (type ...
C++ How to Program (10th 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
- Provide a different implementation of ChoiceQuestion. Instead of storing the choices in an array list, the addChoice method should add the choice to the question text. For this purpose, an addLine method has been added to the Question class. Use the following files: Question.java /** A question with a text and an answer.*/public class Question{ private String text; private String answer; /** Constructs a question with empty text and empty answer. */ public Question() { text = ""; answer = ""; } /** Sets the answer for this question. @param correctResponse the answer */ public void setAnswer(String correctResponse) { answer = correctResponse; } /** Checks a given response for correctness. @param response the response to check @return true if the response was correct, false otherwise */ public boolean checkAnswer(String response) { return response.equals(answer); } /** Add a line of text to…arrow_forwardWrite a Java Program that allows the user to enter an arbitrary number of integer grades from the keyboard. Each grade should be added to an ArrayList called grades. Stop inputting grades when -1 is entered. The program should then iterate through the ArrayList, calculate the average grade, and output it along with the minimum and the maximum grade value.arrow_forwardWrite a Java program that reads each line of an input file called data.txt that consists of a keyword followed by a sequence of numbers separated by commas and save it in arrayList. Then for each row in the arrayList check if the keyword is UP, the numbers are sorted in increasing order, if the key word is DOWN; the numbers are sorted in decreasing order. The sorted sequence of numbers is saved in sorted.txt. For example, if the data.txt contains UP: 25 35 30 40 30 DOWN : 20 30 25 25 DOWN: 35 45 40 15 16 18 The file sorted.txt will contain 25 30 30 35 40 30 25 25 20 45 40 35 18 16 15 Create class Sort to perform all sorting operations. The class also responsible of checking the validity of input file content. All input file records must follow the following format UP/down set of numbersarrow_forward
- Write a Java program that will allow the user to play a hangman game repeatedly until theychoose to stop. The game should randomly choose a secret word from a pre-set list of wordsfor the user to guess. Store the list of words available for play in an array so you can randomlychoose them by index during game play.During a turn, the user will guess one letter at a time. Each letter in the secret word shoulddisplay as an asterisk until the letter is guessed by the user. When a correct letter is guessed,the letter should be displayed in the correct position in place of the asterisk. The user hangshimself with the 8th wrong guess and loses the game.Make a character array to hold the characters and asterisks representing the word beingguessed. You can change the contents of this array as the letters are guessed and revealed. Inother words, this array can be used to display the current state of the secret word each round.Here is the list of words the game should choose from for the secret…arrow_forwardI'm trying to write a Java program that stores a text file of integer values into a 2D array. The integers in each column are separated by commas. I also want to print out the 2D array after it is created this is the text file: Input.text 15, 50, 62, 72, 73, 74 58, 60, 70, 73, 76, 82 43, 59, 65, 72, 82, 65 18, 42, 63, 69, 73, 85arrow_forwardWrite a program in a class EvensOddsAvg that counts the integers that are below the average. Read 15 integers from the keyboard and place them in an array. Compute the sum and count of the evens and the odds separately. Find the average of the integers, and count and display the integers that are below average.arrow_forward
- write a program that reads the students.txt file and stores the name of the student and the grade information as a student object in an arraylist sorts the students names based on their first grade in decreasing order using the selection sort algorithm writes the sorted list as the students last name , middle name (if theres one), first name , and grade information into a text file output example: Robison, Lee 95 80 Green, Alex R 85 60 Waston, Zoe G 100 80 use javaarrow_forward1. Write a program that would resemble a power utility billing system. There will be an input window that would enter or input the meter number (5 numeric digits) and the present meter reading in kilowatt hours, the maximum would be 9999 kilowatts. A search from a 2d-arraylist would be made in order to get the previous meter reading of a particular meter number. The 2d- arraylist consists of meter number (5 numeric digits) and the previous meter reading in kilowatt hours (4 numeric digits with 9999 as maximum value). Provide at least 5 sample data or 5 rows with meter number and previous meter reading each row for the 2d-arraylist. When an input of meter number and present meter reading is made, search the 2d-arraylist for the equivalent meter number. If a match is found, get the kilowatt hour used (KWH) by subtracting the previous meter reading from the present meter reading. Note that if the present meter reading is less than previous meter reading, add 10000 first to the present…arrow_forwardONLY IN JAVA PLS Make as simple as possible Modify the attached program to read in the contents of "A Tale of Two Cities" (download from gutenberg.org) and store each word that is longer than 4 characters in an ArrayList. Use command line arguments for the file name and the minimum length (4). Print the first ten words and last ten words that are in your ArrayList. Upload your .java file and the output of running it. import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner; public class Files{ public static void main(String[] args) throws FileNotFoundException { int minimumStringLength = Integer.parseInt(args[1]); // Open the file. File file = new File("replaceMe"); Scanner inputFile = new Scanner(file); inputFile.useDelimiter("[^a-zA-Z]+"); // Read until the end of the file. while (inputFile.hasNext()) { String word = inputFile.next(); System.out.println(word); }…arrow_forward
- Java In this assignment, you will practice using an ArrayList. Your class will support a sample program that demonstrates some of the kinds of operations a windowing system must perform. Instead of windows, you will be manipulating “tiles.” A tile consists of a position (specified by the upper-left corner x and y), a width, a height, and color. Positions and distances are specified in terms of pixels, with the upper-left corner being (0, 0) and the x and y coordinate increasing as you move left and down, respectively. You won’t have to understand a lot about tiles and coordinates. That code has been written for you. You are writing a small part of the overall system that keeps track of the list of tiles. You are required to implement this using an ArrayList. The only method you need to use from the Tile class is the following: // returns true if the given (x, y) point falls inside this tile public boolean inside(int x, int y) Your class is to be called TileList and must…arrow_forwardWrite a program that initialize an array of size 10. Create a generic code to shift array left and right. Your program should be menu based, after each shifting show menu and array to user again and again.arrow_forwardWrite a Java program to find all triplets (three numbers whose sum equal a given sum (16) from an unsorted array of integers. Read the text file (“triplets.txt”) into an array. This file has 14 rows. Then find all of the combinations of three numbers that sum to 16. Use a main method to read in the data to an array and a second method that will use nested loops to count the numbers of triplets. Your output should look like the following: Original array: [1, 6, 3, 0, 8, 4, 7, 5, 2, 11, 9, 14, 15, 10] Triplets of sum 16 (0 1 15) (0 2 14) (0 5 11) (0 6 10) (0 7 9) (1 4 11) (1 5 10) (1 6 9) (1 7 8) (2 3 11) (2 4 10) (2 5 9) (2 6 8) (3 4 9) (3 5 8) (3 6 7) (4 5 7) Triplets.txt 163084752119141510arrow_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
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License