Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
8. You have a file quotes.txt containing quotes, one per line, on security. Write a function
quote() that takes a piece of text (i.e., a string) as input and prints any quote that
contains that piece of text.
>>> quote('watch')
'Who will watch the watchmen.' Juvenal
quote() that takes a piece of text (i.e., a string) as input and prints any quote that
contains that piece of text.
>>> quote('watch')
'Who will watch the watchmen.' Juvenal
>>> quote('who')
'Anyone who considers arithmetical methods of producing
random digits is, of course, in a state of sin.' John Von
Neumann
>>> quote('is')
'The price of freedom is eternal vigilance.' Thomas
Jefferson
'Anyone who considers arithmetical methods of producing
random digits is, of course, in a state of sin.' John Von
Neumann
'And so it often happens that an apparently ingenious idea
is in fact a weakness which the scientific cryptographer
seizes on for his solution.' Herbert Yardley
'Anyone who considers arithmetical methods of producing
random digits is, of course, in a state of sin.' John Von
Neumann
>>> quote('is')
'The price of freedom is eternal vigilance.' Thomas
Jefferson
'Anyone who considers arithmetical methods of producing
random digits is, of course, in a state of sin.' John Von
Neumann
'And so it often happens that an apparently ingenious idea
is in fact a weakness which the scientific cryptographer
seizes on for his solution.' Herbert Yardley
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 6 steps with 4 images
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 C++ program to do the following: Read the attached file ("TextFile.txt") and the count the number of times each alphabetic letter is used. Do not count punctuation, whitespace, or numbers. Only count letters a-z. When counting, treat lower and upper case characters the same. Use the attached CPP program as a guide to manage the counting. Use the structure and array provided to maintain counts. See examples in the program. When the all processing is completed, display the total for all letter counts. Example Output Below.: This numbers below are not intended to be accurate. No special formatting required but should be readable. A: 103 B: 15 C: 22... // remaining lettersZ: 4 cpp code: #include "stdafx.h" #include <iostream> using namespace std; struct LetterCount { char letter; int count; }; // declare an array of structure const int MAXLETTERS = 26; LetterCount myLetterCount[MAXLETTERS]; int main() { // initialize - MOVE THIS TO A METHOD for…arrow_forwardWrite a Python script that extracts and prints a single record from an input file in which the data is organized by line. Each line contains the name of a person (possibly containing multiple words) followed by the year of his birth. Abbas ibn Firnas ibn Wirda: 809 Muhammad ibn Musa al-Khwarizmi: 780 Abu Al-Walid Muḥammad Ibn Aḥmad Ibn Rushd: 1126 The program uses function extractDataRecord with the specification: @param infile the input text file object @return parts a list containing the name (string) in the first element and the year of birth (int) in the second element. If the end of file was reached, an empty list is returnedarrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forward
- You are not allowed to use strings, cstrings!!! A C++ Program: We have obtained some files that are encoded with a simple method of writing the text from end to beginning. We therefore need a program that reads a file named codedfile.txt that is 500 chars or less and generates a file call clearfile.txt that has the characters stored in revers order. For example, if codedfile.txt contains the characters dlrow olleh, then after running the program clearfile.txt should contain hello world. Do not use strings or cstrings for reasons explained please!arrow_forwardPlease help implement a '+' operator that takes two intervals and takes the smallest interval and then the largest for the end. Example: Interval(4, 6) + Interval(5, 8) equals to Interval(4, 8), and Interval(4, 6) + Interval(7, 8) equals to Interval(4, 8). !!!!!!!This one below here is the .cpp file i need to implement, only file i can change. I worked on it but i keep getting an error which is shown in the image #include <iostream>#include "interval.h"using namespace std; Interval::Interval(int lower_bound, int upper_bound){low = lower_bound;high = upper_bound;} void Interval::print(ostream& out) const{out << "(" << low << ", " << high << ")" << endl;} Interval Interval::operator+(const Interval &other) const{int temp_low, temp_high;if(this->low <= other.low) { temp_low = this->low; }else { temp_low=other.low; }if(this->high >= other.high) { temp_high = this->high; }else { temp_high=other.high; }return…arrow_forwardC++ Implement a standard trie for a set of ASCII strings including a terminating character $ for each word. Create a class that has a constructor that accepts the name of an input file as a parameter (a string), and the class should have an operation that test whether a given string is stored in the trie. The driver should allow user to specify the input data file, output number of words in the trie, and then use a y/n loop to check for a few words. Output yes or no for each search word. You should format your input file's words to lowercase and remove extra characters like comma, periods, etc.arrow_forward
- I need a Java program that will sort and display the contents of a text file by a field selected or typed in by the user. The file name should be text.txt, and it should be a comma delimited file. Here are the lines listed in test.txt that will be sorted: Joe Dirt, custodian, 10-15-2001, 12345 Highway 9, Los Angeles, CA, 90075, 901-555-1234 Tyler Dearden, projectionist, 1-31-1975, 494 Main Street, Hollywood, CA, 90021, 901-555-1235 Jerry Dearden, comedian, 1-30-1974, 12345 Highway 8, New York, NY, 10022, 212-555-1234 The name should be able to be sorted last name first. Profession should be able to be sorted alphabetically, date should be able to be sorted earliest first, street address alphabetically by name of street, city and state alphabetically, and zipcode and phone number numerically. You can ask the user to choose which field to sort and display the list of fields for them to select, or you could have them type in the name of the field to sort by, however works best for…arrow_forwardC++ I have a .txt file that is pretty long and I want the user to be able to change the number of characters per line in it. Spaces shouldn't be counted and the user shouldn't be allowed to put in a number less than 10. For example, The original .txt file says: In other words, what you’re proposing is to link all these documents togetherso that you can easily move from one to the other. In the output I want it to say: Maximum Characters: 10 // User will input the number of characters per line In other // if a word puts the number of characters over the limit set then it will put itself onto the next line words, what you’re proposing is to link all these documents together so that you can easily move from one to the other.arrow_forwardComplete the rotate_text() function that takes 2 parameters, a string data and an integer n. If n is positive, then the function will shift all the characters in data forward by n positions, with characters at the end of the string being moved to the start of the string. If n is 0 then the text remains the same. For example: rotate_text('abcde', rotate_text('abcde', rotate_text('abcde', 1) would return the string 'eabcd' 3) would return the string 'cdeab' 5) would return the string 'abcde' rotate_text('abcde', 6) would return the string 'eabcd' ... and so on. If n is negative, then the function will shift the characters in data backward by n positions, with characters at the start of the string being moved to the end of the string. For example: rotate text('abcde', -1) would return the string 'bcdea'arrow_forward
- please help fastarrow_forwardin c++ codearrow_forwardYour function should open the file given as a parameter and read the data from it into a dictionary. The keys for this dictionary will be the parameter names, and the values of this dictionary will be the values of the corresponding parameters. The data type of the keys in this dictionary is always strings. However, each entry's data type of the value in the dictionary is different: The type of the value of parameter "gamma", is a float. • The type of the value of parameter "beta_normal", is a float. • The type of the value of parameter "beta_intervention", is a float. • The type of the value of parameter "simulation_days', is an integer. The type of the value of parameter "N", is a float. Once the dictionary is built, the function should return it.arrow_forward
arrow_back_ios
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