Suppose that you have two text files that contain sequences of integers separated by whitespace (blank space, tabs, and line breaks). The integers in both files appear in sorted order, with smaller values near the beginning of the file and large values closer to the end. Write a pseudocode
Want to see the full answer?
Check out a sample textbook solutionChapter 13 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (8th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
C++ How to Program (10th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- JAVA PPROGRAM Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find matches you should print the name and the line numbers where the match was found. While entering the file name, the program should allow the user to type quit to exit the program. If the file with a given name does not exist, then display a message and allow the user to re-enter the file name. The file may contain up to 100 names. You can use an array or ArrayList object of your choosing, however you can only have one array or ArrayList. Input validation: a) If the file does not exist, then you should display a message "File 'somefile.txt' is not found." and allow the…arrow_forwardWrite a program that reads the strings from file SortedStrings. txt and report whether the strings in the files are stored in ascending order. If the strings are not sorted in the file, display the first two strings that are out of order.arrow_forwardComputer Science Using Java, write a simple Insertion Sort program that can read in integers from a text file (line by line) and sort them into another text file. Use inFile and outFile for the input and output files, respectively. Also make sure that the algorithm keeps track of the comparisons and exchanges performed by the sort so that they may be printed out in the console after the sort is completedarrow_forward
- In Java Oleae nust read a file 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 GrandCanyon1996_photo.jpg IndianaDunes1987_photo.jpg LakeClark2009_photo.jpg…arrow_forwardYou are a cyber investigator, your task is to write a python program that can read file signatures from a file and save them into a list. Each file signature is an element of your list. Then, try to find out if there is a JPG file in there. If there is a JPG file, print out a True on screen. (File Signature for JPG file is: FF D8 FF DB) The input file is: FSCS360_Midterm_Exam_Part2.txtarrow_forwardWrite a program to draw a quiz score histogram. Your program shouldread data from a file. Each line of the file contains a number in the range0-10. Your program must count the number of occurrences of each scoreand then draw a vertical bar chart with a bar for each possible score (0-10) with a height corresponding to the count of that score. For example,if 15 students got an 8, then the height of the bar for 8 should be 15.Hint: Use a list that stores the count for each possible score. An examplehistogram is shown below: o o D D0 1 2 3 4 5 6 7 8 9 10arrow_forward
- The python function first_words takes one parameter, fname, the name of a text file, and returns a list containing the first word from each line of the file. For example, if the file contents are: apples are red bananas are yellow limes are green then the list ["apples", "bananas", "limes"] should be returned.NOTE: You may assume the file will contain no blank lines.BIG HINT: If line is a string representing a line of text (inside of a for loop!), then L = line.split() creates a list of the words in the line.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_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_forward
- Write a program that reads 10,000 words into an array of strings. The program will then read a second file that contains an undetermined number of words and search the first array for each word. The program will then report the number of words in the second list that were found on the first list. Read the 10,000 words from the "List of 10000 Random Words" text file into an array of strings. Then read the words from the "Search Words" text file, one at a time, and search for them in the array. Report the count of the number of words found.arrow_forwardWrite a python program that reads the contents of a text file. The program should create a dictionary in which the keys are the individual words found in the file and the values are the number of times each word appears. For example, if the word "the" appears 128 times, the dictionary would contain an element with 'the' as the key and 128 as the value. The program should either display the frequency of each word or create a second file containing a list of each word and it's frequency. This program has really been giving me trouble. Any help is great appreciated. Thanks so much!arrow_forwardPython usearrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT