Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 15, Problem 4E
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 first reads in the name of an input file, followed by two strings representing the lower and upper bounds of a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds).
Ex: If the input is:
input1.txtammoniatedmillenniumand the contents of input1.txt are:
aspirationclassifiedfederationgraduationmillenniumphilosophyquadraticstranscriptwildernesszoologiststhe output is:
aspirationclassifiedfederationgraduationmillenniumNotes:
There is a newline at the end of the output.All input files are hosted in the zyLab and file names can be directly referred to. input1.txt is available to download so that the contents of the file can be seen.In the tests, the first word input always comes alphabetically before the second word input.
Write a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of
words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the
file) without any duplicates.
Ex: If the input is:
inputl.csv
and the contents of input1.csv are:
hello, cat,man, hey, dog, boy, Hello, man, cat,woman, dog, Cat, hey, boy
the output is:
hello 1
cat 2
man 2
hey 2
dog 2
boy 2
Hello 1
woman 1
Cat 1
Note: There is a newline at the end of the output, and input1.csv is available to download.
339092.2126252.ax3zav7
A file words.txt contains a large number of English Language words, one per record. Write a program that uses this file to implement a simple word checker. First, read all the words into a collection. Then, using this collection find the average length of all the words and write this number to the console.Finally, using a text file that contains written English paragraphs, the program should examine each word of each line and output to the console all the words that are not in the collection as potentially misspelled words. Write to the console how many words in this text file are above the average length of the dictionary words computed above.
Chapter 15 Solutions
Programming in C
Ch. 15 - Type in and run the three programs presented in...Ch. 15 - Prob. 2ECh. 15 - Write a program to copy one file to another,...Ch. 15 - Write a program that merges lines alternately from...Ch. 15 - Write a program that writes columns m through n of...Ch. 15 - Write a program that displays the contents of a...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
What is array bounds checking? Does C++ perform it?
Starting Out with C++ from Control Structures to Objects (9th Edition)
What is the purpose of a DBMS?
Database Concepts (8th Edition)
Identify the zero-force members in the truss. Prob. F6-5
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
What keeps a computer on the Internet from recording copies of all the messages passing through it?
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Determine the maximum deflection of the simply supported beam. The beam is made of wood having a modulus of ela...
Mechanics of Materials (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
- Write a program that receives a coded message file(Lab3ExtraCreditCT.txt) from your local espionage agent and decodes it into a file using standard English. The problem is your agent forgot to tell you the key used to decode the message. Fortunately, this is a simple substitution code consistently using 1 alphanumeric character to represent another, this is case sensitive. All other characters are not substituted, so a space will always be a space, a – will always be a –, a @ will always be a @, etcetera. You may use the following table to help you, it contains the most common letters used in the English language in descending order. E A R I O T N S L C U D P M H G B F Y W K V X Z J Q 0 5 3 2 4 6 8 1 9 7 Using the following key to convert plaintext to coded text: Plaintext = Now is the time for all good men to come to the aid of their country. Key = THEQUICKBROWNFXJMPSVLAZYDG The file your program outputs should look like this: Coded Text = Fxz bs vku vbnu ixp tww…arrow_forwardWrite a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates. Ex: If the input is: input1.csv and the contents of input1.csv are: hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boyarrow_forwardWrite a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates. Ex: If the input is: input1.csv and the contents of input1.csv are: hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boy the output is: hello 1 cat 2 man 2 hey 2 dog 2 boy 2 Hello 1 woman 1 Cat 1 Note: There is a newline at the end of the output, and input1.csv is available to download.arrow_forward
- consider a program that reads data from a text file called: "klingon-english.txt" (shown below). How would one construct such a program with the following conditions: 1. Ask the user to choose a Klingon consonant they want to practice with. Ask again if the user’s answer is not a valid Klingon consonant, until the user enters a valid consonant. 2. Find a Klingon word that starts with the chosen consonant (the text file contains only one word that starts with any given consonant, so you don’t need to use the random library) 3. Ask the user to translate the chosen word into Klingon 4. Print "Correct" if the user’s answer is correct 5. Print "Sorry, you’re wrong!" if the user’s answer is wrong 6. Print The correct answer is ... if all three user’s answers are wrong You will also factor in this version: 7. If the answer is incorrect, show the first hint: the first and last characters of the correct Klingon word. When showing a hint, replace all other characters with a star (*) 8. If the…arrow_forwardWrite a program that first reads in the name of an input file and then reads the file using the csv.reader() method. The file contains a list of words separated by commas. Your program should output the words and their frequencies (the number of times each word appears in the file) without any duplicates. Ex: If the input is: input1.csvand the contents of input1.csv are: hello,cat,man,hey,dog,boy,Hello,man,cat,woman,dog,Cat,hey,boythe output is: hello 1cat 2man 2hey 2dog 2boy 2Hello 1woman 1Cat 1Note: There is a newline at the end of the output, and input1.csv is available to download.arrow_forwardModify your program from Learning Journal Unit 7 to read dictionary items from a file and write the inverted dictionary to a file. You will need to decide on the following: How to format each dictionary item as a text string in the input file. How to covert each input string into a dictionary item. How to format each item of your inverted dictionary as a text string in the output file. Create an input file with your original three-or-more items and add at least three new items, for a total of at least six items. Include the following in your Learning Journal submission: The input file for your original dictionary (with at least six items). The Python program to read from a file, invert the dictionary, and write to a different file. The output file for your inverted dictionary. A description of how you chose to encode the original dictionary and the inverted dictionary in text files. Show more... Modify your program from Learning Journal Unit 7 to read dictionary items from a…arrow_forward
- please use python Write a program that first reads in the name of an input file, followed by two strings representing the lower and upper bounds of a search range. The file should be read using the file.readlines() method. The input file contains a list of alphabetical, ten-letter strings, each on a separate line. Your program should output all strings from the list that are within that range (inclusive of the bounds). Ex: If the input is: input1.txt ammoniated millennium and the contents of input1.txt are: aspiration classified federation graduation millennium philosophy quadratics transcript wilderness zoologistsarrow_forwardWrite a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: • Each row contains the title, rating, and all showtimes of a unique movie. • A space is placed before and after each vertical separator (I) in each row. • Column 1 displays the movie titles and is left justified with a minimum of 44 characters. . If the movie title has more than 44 characters, output the first 44 characters only. • Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. • Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of…arrow_forwardWrite a program that uses an initially empty file to store a sorted list of integers entered by the user. Theintegers are stored in binary form. Each time the program is run, it opens the file and outputs the list of storedintegers onto the screen. The program then asks the user to enter a new integer X. The program then looks at theinteger at the end of the file. If that integer is less than or equal to X, the program stores X at the end of the fileand closes the file. Otherwise, the program starts at the end of the file and works toward the beginning, movingeach value in the file that is greater than X up by one until it reaches the position in the file where X should bestored. The program then writes X at that position and closes the file.arrow_forward
- Write a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forwardWrite a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forwardWrite a C++ program that reads first name and last name from two txt files, input1.txt and input2.txt respectively and stores them in two separate arrays. Then merges these two arrays into another txt file output.txt. Example: Intput1.txt: Markus Input2.txt: Stocker Output.txt: Markus Stockerarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
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