Concept explainers
Suppose that you have a binary file that contains numbers whose type is either int or double. You don’t know the order of the numbers in the file, but their order is recorded in a string at the beginning of the file. The string is composed of the letters i (for int) and d (for double) in the order of the types of the subsequent numbers. The string is written using the method writeUTF. For example, the string “iddiiddd” indicates that the file contains eight values, as follows: one integer, followed by two doubles, followed by two integers, followed by three doubles. Read this binary file and create a new text file of the values, written one to a line.
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
Starting Out with Python (3rd Edition)
Web Development and Design Foundations with HTML5 (8th Edition)
Software Engineering (10th Edition)
Modern Database Management
Starting Out with C++: Early Objects (9th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
- A cryptogram is a coded message using alphabet substitution. For example, the letter "A" in the cryptogram might stand for the letter “Ż." You are to write a program that allows the program user to decipher cryptograms, like the following one. Your program should allow the user to change one letter and display the change, then change another letter and display the change etc. Here is a sample cryptogram to be decoded. String crypto.Part1 = "EKBQUDUHJ XK BCA AYGADDAMB KGENAHUEB UP" String crypto.Part2 = "BCA ZUQDR FDEIA BCA KBEWQK PUG UOQ PEODBK." String crypto.Part3 = "CUZALAQ PQXAMRK UOQ EODBK DXA MUB IM BCA" String crypto.Part4 = "KBEQK FOB XM UOQKADLAK."arrow_forwardLab Task 04: Include the methods in the file KMP_Implementation.txt in a complete Java program that prompts for and reads a text string and then a text pattern to search for in the text. It then displays the result of the search. Sample program runs: Enter the text: ABABСАВАВАВСАВАВСАВАВСАВАВКККАВАВСАВАВ Enter the pattern to search for: ABABCABAB Pattern found at these text starting indexes: 0 Enter the text: A KFUPM STUDENT Enter the pattern to search for: KFE Pattern not in text. 7 12 17 29arrow_forwardUse for loop in Java language Write the method stringSplosion().* * The method takes one parameter, a non-empty String str (such as "Code") and* returns a String in the form "CCoCodCode". Notice that this includes the* first character of the original String, followed by the first two characters,* and so on until the whole String is used.* * Examples: stringSplosion("Code") returns "CCoCodCode" stringSplosion("abc")* returns "aababc" stringSplosion("x") returns "x"* * @param str the input String to process.* @return a new String as described above.arrow_forward
- In pythonarrow_forwardreads in a file of student academic credit data. Each line of the input filewill contain the student name (a single String with no spaces), the number of semester hours earned (an integer),the total quality points earned (a double).Here is the students.dat data file:students.dat Smith 27 83.7Jones 21 28.35Walker 96 182.4Doe 60 150Wood 100 400Street 33 57.4Taylor 83 190Davis 110 198Smart 75 292.5Bird 84 168Summers 52 83.2 My question is how can I create the <<students.dat>> I already have the code but I just need help to create the students.datarrow_forwardDNA sequences are strings made of combinations of four letters: A, C, G, and T. A substring refers to a string that is a continuous segment of a larger string; in the context of DNA, this would be a fragment of our DNA sequence. Write a program that asks the user for two input strings: a complete DNA sequence a DNA fragment whose occurrence is to be found in our complete DNA sequence. The program must display the number of matches as the output. Make sure to validate that your sequence is a DNA sequence -- i.e., that it contains no letters aside from A, C, G, and T.arrow_forward
- In this project, you will develop algorithms that find road routes through the bridges to travel between islands. The input is a text file containing data about the given map. Each file begins with the number of rows and columns in the map considered as maximum latitudes and maximum longitudes respectively on the map. The character "X" in the file represents the water that means if a cell contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water. The character "0" in the file represents the road connected island. That means if a cell contains "0" then the traveler is allowed to occupy that cell as this car can drive on roads. The traveler starts at the island located at latitude = 0 and longitude = 0 (i.e., (0,0)) in the upper left corner, and the goal is to drive to the island located at (MaxLattitude-1, MaxLongitudes-1) in the lower right corner. A legal move from an island is to move left, right, up, or down to an immediately adjacent…arrow_forwardIn this project, you will develop algorithms that find road routes through the bridges to travel between islands. The input is a text file containing data about the given map. Each file begins with the number of rows and columns in the map considered as maximum latitudes and maximum longitudes respectively on the map. The character "X" in the file represents the water that means if a cell contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water. The character "0" in the file represents the road connected island. That means if a cell contains "0" then the traveler is allowed to occupy that cell as this car can drive on roads. The traveler starts at the island located at latitude = 0 and longitude = 0 (i.e., (0,0)) in the upper left corner, and the goal is to drive to the island located at (MaxLattitude-1, MaxLongitudes-1) in the lower right corner. A legal move from an island is to move left, right, up, or down to an immediately adjacent…arrow_forwardWrite a method that finds the number of occurrences of a specified character in a string using thefollowing header:public static int countLetter(String str, char ch)Write a test program that prompts the user to enter a word and a letter of the alphabet. Theprogram should then count and display the number of occurrences of the letter in the word. Asample dialog for the program is shown below:arrow_forward
- Ex: Use getline() to get a line of user input into a string. Output the line. Enter text: IDK if I'll go. It's my BFF's birthday. You entered: IDK if I'll go. It's my BFF's birthday. Search the string (using find()) for common abbreviations and print a list of each found abbreviation along with its decoded meaning. Ex: Enter text: IDK if I'll go. It's my BFF's birthday. You entered: IDK if I'll go. It's my BFF's birthday. BFF: best friend forever IDK: I don't know Support these abbreviations: BFF -- best friend forever IDK -- I don't know . JK -- just kidding TMI -- too much information TTYL-talk to you later 1 #include 2 // FIXME include the string Library 3 using namespace std; 4 5 int main() { 6 7 8 9 10 } /* Type your code here. */ return 0; main.cpparrow_forwardCreate a text file of names, (3 names per line, 5 lines in total) followed by an age for each name. Go through the file and sum the ages. Create an output file with each persons name followed by age and then a line at the end of the output file that says “sum of all ages is: x”. Simple Java programming. Should include things like bufferedReader, fileReader, printWriter, fileWriter, file close, try-with-resources, Scanner, catch/try, etc. Include Java file and txt file. Thank you.arrow_forwardIN JAVA ONLY PLEASE. POSITIVE REVIEW WILL BE LEFT FOR CORRECT LANGUAGE ONLY AND NOT COPY PASTE FROM INCORRECT ANSWER A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txt and the contents of ParkPhotos.txt are: Acadia2003_photo.jpg AmericanSamoa1989_photo.jpg BlackCanyonoftheGunnison1983_photo.jpg CarlsbadCaverns2010_photo.jpg CraterLake1996_photo.jpg…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