Suppose that a binary file contains exactly three numbers written to the file using the method writeDouble of the class ObjectOutputStream. Suppose further that you write a
Want to see the full answer?
Check out a sample textbook solutionChapter 10 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Additional Engineering Textbook Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with Python (3rd Edition)
Problem Solving with C++ (10th Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Using MIS (10th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
- Write a program that prompts the user for an input file name, reads all words from the input file, and writes the words to the output file named sentences.txt. Start a new line whenever a word ends in a period, question mark, or exclamation mark.arrow_forwardWhat would be the printout of the following code if the same file.txt was used as above? int main() { fstream file("file.txt", ios::in); char ch; file.get(ch); while (!file.eof()) { cout << ch << " "; file.get(ch); } file.close(); return 0;} Group of answer choices I have a dream. I h a v e a d r e a m . Ihaveadream. I have a dream.I have a dream.arrow_forwardWrite a program that takes its input from a binary file of numbers of type double and outputs the average of the numbers in the file to the screen. The file contains nothing but numbers of type double written to the file with write Double.arrow_forward
- Write a program to read two file names from the command line. If the number of arguments in the command line are more than or less than two, then the program should terminate with an appropriate error message. Otherwise, it should append the contents of the second file to the first file.arrow_forwardDoes the class FileOutputStream have a constructor that accepts a filename as an argument?arrow_forwardWrite a program countfile.c that calculates and prints on screen the number of bytes or number of lines in a file. To print the number of lines in the file myfile.txt, the program is run from the command line with two arguments as follows countfile.exe -l myfile.txt or, to print the number of bytes in the file myfile.txt, it would be run as countfile.exe -b myfile.txt EXAMPLE: Suppose the file myfile.txt contains the following samantha jacob 58 91 Then running countfile.exe -l myfile.txt would print 4 on the screen. And running countfile.exe -b myfile.txt would print 15 on the screen. If as a switch anything other than -l or -b is used, the program should give an error message and exit with code 1. If the file is not found, then it should give a message saying no such file exists, and exit with code 2. If everything runs correctly the program should return 0.arrow_forward
- Create a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened and once opened with any stream of choice, all the content in the file is printed to the screen. You are additionally expected to deal most common exceptions(See samples below) [HINT: DO NOT PROVIDE A PATH BUT RATHER ONLY OPEN THE FILE WITH RELATIVE PATH/FILENAME] Sample run 1: Enter filename: input.txt sample output 1: Hello files, I got the content NB: input.txt contains "Hello files, I got the content" as the data [See sample file] Sample run 2: Enter filename: myText.txt sample output 2: Invalid file : myText.txt could not be found in the current directory NB: myText.txt is not a valid file Requested files InClassDemo.java input.txt 1 Hello files, I got the contentarrow_forwardCreate a simple java program that reads all the content in a .txt file, the user will enter the filename to be opened and once opened with any stream of choice, all the content in the file is printed to the screen. You are additionally expected to deal most common exceptions(See samples below) [HINT: DO NOT PROVIDE A PATH BUT RATHER ONLY OPEN THE FILE WITH RELATIVE PATH/FILENAME] Sample run 1: Enter filename: input.txt sample output 1: Hello files, I got the content NB: input.txt contains "Hello files, I got the content" as the data [See sample file]arrow_forwardWrite a test client which takes a file path as an argument and reads each line one by one. The file can contain any number of DNA sequences (i.e., Strings.). After reading each DNA sequence, your code should print the DNA sequence first. Please follow the screenshot below for the output format. If the DNA sequence is valid DNA, report that and print out its complement as well as whether or not it is a Watson-Crick complemented palindrome. If the DNA sequence is not a valid DNA, only report that. Continue this process for each DNA sequence in the text file. Separate the outputs for each sequence by printing a line as shown in the screenshot. In your project directory, create a new directory named ‘in’. The in folder will contain the input text file, titled sequences.txt. To run the code, your program argument should be in/sequences.txt Method Summary. Return Type Method 1 boolean isValid(String DNA) 2 String…arrow_forward
- Write a program that reads the contents of a text file and prints the letter that starts the mostunique words in that file.arrow_forwardWrite a program called ReverseText.exe that takes two file names as command-line arguments. TheReverseText program should reads the characters from the first file and write them into the second file inreverse order. Test your program out using the small text file iso_8859-1.txt provided with thisassignment. Once you are confident that your program is working correctly, run it on the much larger fileWar_of_the_Worlds.txt uploaded along with this assignment. For example, when you use this program on the command line it should be like this:ReverseText.exe War_of_the_Worlds.txt War_of_the_Worlds_reversed.txt Remember, if you are using fgets(), it will only return one line of the book at a time. You willhave to go through the book multiple times and make frequent use of the rewind() function.HintYou can use the strlen() function (that is part of the string.h C Standard Library) to check thelength of the string you read in using fgets(). ALSO, if you could please help me know and…arrow_forwardAs in Self-Test Exercise 5, write some code that will create a stream namedoutStream that is a member of the class PrintWriter, and that connects thisstream to a text file named sam so that your program can send output to the file.This time, however, do it in such a way that, if the file sam already exists, the oldcontents of sam will not be lost, and the program output will be written after theold contents of the file.arrow_forward
- 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