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 10.4, Problem 23STQ
Does the class FileInputStream have a method named readInt? Does it have one named readDouble? Does it have one named readUTF?
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Write a program that stores names and phone numbers from a text file in adictionary, with the name being the key. Write a method that does a reverselookup, that is, finds a name given a phone number. Write a Windowsapplication to test your implementation.
code in c#
Add a method called save to your Person class. This method will write the object out to a binary file. Use the Serializeable format. Name the file accountNumber.dat where accountNumber is the credit card number from the object.
Code in Java
/////////////////FIles given (Demo.java) \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\import java.util.ArrayList;import java.util.Collections;public class Demo {public static void main(String[] args) {Person test1 = new Person("Eachelle Balderstone",30526110612015L,9866.30,false);Person test2 = new Person("Brand Hallam",3573877643495486L,9985.21,false);Person test3 = new Person("Tiphanie Oland",5100172198301454L,9315.15,true);ArrayList<Person> list = new ArrayList<>();list.add(test1);list.add(test2);list.add(test3);Collections.sort(list);System.out.printf("%20s%20s%10s%10s\n", "Name", "Account Number", "Balance", "Cash Back");for (Person current : list) {System.out.println(current);}}}
Please use JAVA code to write the solution, thanks
A text file called names.txt contains one name per line, e.g.,AllisonJohnWilliamJohnetc.Names can be duplicated in the file. Write the code that:1. Reads the names line by line.2. Stores each name and the number of times the name appears in one collection.3. Prints the number of different names to the console.4. Prints the names and how many times each name appears on the console.Think about what data structure would work in associating each name with the number of times it appears in the file. You do not need to write imports.
Chapter 10 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 10.1 - Why would anybody write a program that sends its...Ch. 10.1 - When we discuss input, are we referring to data...Ch. 10.1 - What is the difference between a text file and a...Ch. 10.2 - Write some code that will create a stream named...Ch. 10.2 - Prob. 5STQCh. 10.2 - Prob. 6STQCh. 10.2 - Prob. 7STQCh. 10.2 - Write some code that will create a stream named...Ch. 10.2 - Suppose you run a program that writes to the text...Ch. 10.2 - Prob. 10STQ
Ch. 10.3 - Prob. 11STQCh. 10.4 - Write some Java code to create an output stream of...Ch. 10.4 - Give three statements that will write the values...Ch. 10.4 - Give a statement that will close the stream toFile...Ch. 10.4 - What import statement(s) do you use when creating...Ch. 10.4 - Prob. 16STQCh. 10.4 - Give three statements that will read three numbers...Ch. 10.4 - Give a statement that will close the stream...Ch. 10.4 - Can you use writeInt to write a number to a file...Ch. 10.4 - Can you use readUTF to read a string from a text...Ch. 10.4 - Prob. 21STQCh. 10.4 - Prob. 22STQCh. 10.4 - Does the class FileInputStream have a method named...Ch. 10.4 - Does the class FileOutputStream have a constructor...Ch. 10.4 - Does the class ObjectOutputStream have a...Ch. 10.4 - Prob. 26STQCh. 10.4 - Suppose that a binary file contains exactly three...Ch. 10.4 - The following code appears in the program in...Ch. 10.4 - Prob. 29STQCh. 10.5 - Prob. 30STQCh. 10.5 - Prob. 31STQCh. 10.5 - Prob. 32STQCh. 10.5 - Prob. 33STQCh. 10.6 - Prob. 34STQCh. 10.6 - Prob. 35STQCh. 10 - Write a program that will write the Gettysburg...Ch. 10 - Modify the program in the previous exercise so...Ch. 10 - Write some code that asks the user to enter either...Ch. 10 - Write a program that will record the purchases...Ch. 10 - Modify the class LapTimer, as described in...Ch. 10 - Write a class TelephoneNumber that will hold a...Ch. 10 - Write a class contactInfo to store contact...Ch. 10 - Write a program that reads every line in a text...Ch. 10 - Repeat the previous exercise, but write the new...Ch. 10 - Write a program that will make a copy of a text...Ch. 10 - Suppose you are given a text file that contains...Ch. 10 - Suppose that you have a binary file that contains...Ch. 10 - Suppose that we want to store digitized audio...Ch. 10 - Write a program RecoverSignal that will read the...Ch. 10 - Even though a binary file is not a text file, it...Ch. 10 - Write a program that searches a file of numbers...Ch. 10 - Write a program that reads a file of numbers of...Ch. 10 - The following is an old word puzzle: Name a common...Ch. 10 - The Social Security Administration maintains an...Ch. 10 - The following is a list of scores for a game....Ch. 10 - Write a program that checks a text file for...Ch. 10 - Prob. 5PPCh. 10 - Prob. 6PPCh. 10 - Revise the class Pet, as shown in Listing 6.1 of...Ch. 10 - Write a program that reads records of type Pet...Ch. 10 - Prob. 12PP
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
In pseudocode, this statement causes a function to end and sends a value back to the part of the program that c...
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Summarize the booting process.
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Declare method sphereVolume to calculate and return the volume of the sphere. Use the following statement to ca...
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
48. A bail is thrown vertically into the air with an initial kinetic energy of 2,500 joules [J]. As the ball ri...
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
True or False: A class may only implement one interface.
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
For the circuit shown, find (a) the voltage υ, (b) the power delivered to the circuit by the current source, an...
Electric Circuits. (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
- Write a program that stores names and phone numbers from a text file in adictionary, with the name being the key. Write a method that does a reverselookup, that is, finds a name given a phone number. Write a Windowsapplication to test your implementation.arrow_forwardIs the character repeating problem Within the Utils class that is provided to you in "Requested Files" you are to modify the method isRepeatingCharacter(String s)If all of the individual characters in the string are the same, return the boolean value true when the method is finished. Otherwise, return false.arrow_forwardMake a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help.arrow_forward
- UOWD Library is asking you to write a Java program that manages all the items in the Library. The library has books, journals, and media (DVD for example). All items have a name, author(s), and year of publication. A journal also has a volume number, while a media has a type (audio/video/interactive). The user of your program should be able to add an item, delete an item, change information of an item, list all items in a specific category (book, journal, or media), and print all items (from all categories). A menu asks the user which operation s/he wants to perform. Important: make use of collections, inheritance, interfaces, and exception handling wherever appropriate.arrow_forwardJava programmingarrow_forwardWrite a Java Code for two files: PangramCheckerTest.java, PangramChecker.java Instructions: Determine if a sentence is a pangram. A pangram (Greek: παν γράμμα, pan gramma, "every letter") is a sentence using every letter of the alphabet at least once. The best known English pangram is: The quick brown fox jumps over the lazy dog. The alphabet used consists of ASCII letters a to z, inclusive, and is case insensitive. Input will not contain non-ASCII symbols.arrow_forward
- Suppose you define a class named YourClass in a file. What name shouldthe file have?arrow_forwardWhat is the type of a value returned by the method readLine in the classBufferedReader? What is the type of a value returned by the method read inthe class BufferedReader?arrow_forwardABC airport has a list of travelers kept in a file (see below) and has asked you to write a complete Q7 program that reads from the user a filename and a destination and prints all the travelers (Format: --Last name, First name) that travelled to that destination. O points if you code everything in main. You should have at least 2 methods: main and one other method (excluding the readFile method). You can assume that the method: public static String (] [] readFile (String filename) is available (in the same program). That is, you can just use it to read from the file. It returns a String[][] with as many rows as lines in the file, and each row will have as many Strings as comma-separated items on that line in the file. For the sample file below, the String[]] will look like this: [ ["Alex Aiono","Johanesburg", "8-6-2017"], ["Marcus Schultz","Marrakech","1-24-2017"], ..] Sample file (travelers.txt) DO NOT HARDCODE THE FILE NAME. Alex Aiono,Johanesburg,8-6-2017 Marcus Schultz,Marrakech,…arrow_forward
- write in java 1. Create a shopping class containing 5 objects name and price (range between 10-50) using serialization. Use deserialization to read the objects back from the file. The program should then print all the objects with their price and the sum of total price of all products.arrow_forwardpackage comp1110.exam; import java.io.IOException; /** * COMP1110 Exam, Question 2 * * IMPORTANT NOTE: This question depends on knowledge of Java NIO, which is not * taught in S2 classes. It can be solved without NIO, but is not intended for * students who are not familiar with NIO. */ public class Q2Awk { /** * Read the specified input file in comma-separated-value (CSV) format and * extract all values from the specified column, writing the values * (one per line) to the specified output file. * If sortOutput==true, the values in the specified column are written in * alphabetical order to the output file; otherwise, the values are written * in the same order as they occur in the input file. * If the specified column is missing a value for a given line, then that * line is ignored and is not included in the output. * If the specified column is not included in any line of the input file, * then the output file is empty. * <p> * For example, if the input file "Q2kate.csv" contains…arrow_forwardWrite a java program that will solve the problem: For a given ListADT that contains Items with numerical key value (integer), reorder it into two partitions of equal size such as the difference between the sum of those integers in the first partition and the second partition would be minimal. The program should have a class code separate from the main code. 1. Use a separate file to store the graph data. The name of the file should be "yourname_floyd.dat". 2. Use a few (3- 4) different graphs to compare actual performance (execution time).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
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License