Concept explainers
write the code to lookup, add and remove phone
entries from the phonebook text file .
These are the code we use for the lookup, add and remove in the case statement.
(Lookup)
# Look someone up in the phone book
grep $1 phonebook
(add)
echo "$1 $2" >> phonebook
sort -o phonebook phonebook
(Remove)
grep -v "$1" phonebook > /tmp/phonebook
mv /tmp/phonebook phonebook
Write a complete Bash script which will accept up to three command-line arguments: the first one is either (lookup, add or remove), the second one is a name enclosed in single quotes and the third one (if doing an add) is a phone number enclosed in single quotes. Using a case statement to match on either lookup, add or remove, the script should then perform the requested operation. Again here, you should first check for null arguments before continuing with the rest of the script or requested operation. In addition, the person may not be in the phonebook for lookup or remove so, you need to account for this.
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
- Explain your approach to reading individual bytes from a file Some of the data may be encrypted by adding 5 to a byte. If encrypted data has a value between zero (0) and four (4), what will the decrypted value be? GUI Design. Create a wireframe(s) for the GUI (See CRUD table in homework assignment) Create an algorithm for the required program. Submit a flowchart (as an image filearrow_forward>> classicVinyls.cpp For the following program, you will use the text file called “vinyls.txt” attached to this assignment. The file stores information about a collection of classic vinyls. The records in the file are like the ones on the following sample: Led_Zeppelin Led_Zeppelin 1969 1000.00 The_Prettiest_Star David_Bowie 1973 2000.00 Speedway Elvis_Presley 1968 5000.00 Spirit_in_the_Night Bruce_Springsteen 1973 5000.00 … Write a declaration for a structure named vinylRec that is to be used to store the records for the classic collection system. The fields in the record should include a title (string), an artist (string), the yearReleased (int), and an estimatedPrice(double). Create the following…arrow_forwardCreate an anonymous block that a teacher can run to insert the student's grade on a particular assignment. Accept a NUMERIC_GRADE, CLASS_ASSESSMENT_ID, CLASS_ID and STU_ID. Use “today‟s” date for the DATE_TURNED_IN.arrow_forward
- For main.CPP file in lines 32 and 33 on visual studio community 2022 it's saying that getline is unidentified why is that and how do i fix it.arrow_forwardpythhon 3arrow_forwardIn Racket, which of the following contains (or is by itself) a call of a selector for the defined movie struct? (Select all that apply)A) (make-movie "Beauty and the Beast" "Gary Trousdale" 92 true)B) (movie-dvd? LION)C) (check-expect (movie-length TOY) 81)D) (movie? 81) (define-struct movie (title director length dvd?)); a Textbook is a (make-book String String Natural Boolean); interp: a movie where; title is the movie’s title; director is the name of the movies’s director; length is the length of the movie in minutes; dvd? is whether the movie is available in dvd format (if true)(define TOY (make-movie “Toy Story" "John Lasseter" 81 true))(define LION (make-movie "The Lion King" "Rob Minkoff" 89 false))arrow_forward
- Add a prompt to ask the user to input their last name (no spaces ; please use underscores if needed), age and a balance of their choice. Create a new entry in the patient_list array with this information [Important note: you can statically modify the code to have the patient_list array hold an extra entry ; no need to do any dynamic memory allocation to accommodate the new entry]. #include <iostream> #include <cstdlib> #include <cstring> using namespace std; // Declaring a new struct to store patient data struct patient { int age; char name[20]; float balance; }; // TODO: // IMPLEMENT A FUNCTION THAT COMPARES TWO PATIENTS BY AGE // THE FUNCTION RETURNS AN INTEGER AS FOLLOWS: // -1 IF THE AGE OF THE FIRST PATIENT IS LESS // THAN THE SECOND PATIENT'S AGE // 0 IF THE AGES ARE EQUAL // 1 OTHERWISE // TODO: // IMPLEMENT A FUNCTION THAT COMPARES TWO PATIENTS BY BALANCE DUE // THE FUNCTION RETURNS AN INTEGER AS…arrow_forwardOutput should be 5. Please help me find my error, and create 5 tests below in a seperate file using the corrected code. Thanks. 1. create a strawberryStand object2. create one or more MenuItem objects and add them to the strawberryStand's menu3. create a dictionary of sales for the day that includes sales of at least one item that isn't in the menu4. try calling enter_sales_for_today(), passing that sales dictionary as the argument5. If an InvalidSalesItem is raised, it should be caught with a try/except that prints an explanatory message for the user (otherwise the function should proceed normally). class MenuItem: def __init__(self, name, wholesale_cost, selling_price): self.name = name self.wholesale_cost = wholesale_cost self.selling_price = selling_price def get_name(self): return self.name def get_wholesale_cost(self): return self.wholesale_cost def get_selling_price(self): return self.selling_price class SalesForDay:…arrow_forwardPlease answer the question or example in the uploaded photos and please explain what is going on !arrow_forward
- When coding a program that uses an input file, how would you create a new scanner object as on input file? The name of the input text file is critterinventory.txt.arrow_forwardplease follow the instructions ..i added the term_data.txt screenshot so that it would be easier for you to see it then make the txt file from your own PC.. please modify this code to calculate idf, and therefore tf-idf, using this new formula. Hint: You may need to include a new header file to make this work! #include <iostream>#include <cmath> int main() { int termCount = 5; // Number of times the term appears in the document int totalWordCount = 100; // Total number of words in the document int docCount = 10; // Number of documents containing the term int totalDocCount = 1000; // Total number of documents // Calculate term frequency (tf) double tf = (double) termCount / totalWordCount; // Calculate inverse document frequency (idf) double idf = log((double) totalDocCount / docCount); // Calculate term frequency - inverse document frequency (tf-idf) double tfidf = tf * idf; std::cout << "TF: " << tf <<…arrow_forwardCreate a .txt file with 3 rows of various movies data of your choice in the following table format: Movie ID number of viewers rating release year Movie name 0000012211 174 8.4 2017 "Star Wars: The Last Jedi" 0000122110 369 7.9 2017 "Thor: Ragnarok" Create a class Movie which instantiates variables corresponds to the table columns. Implement getters, setters, constructors and toString. ----Important 1. Implement two search methods to search Movies by their rating from unsorted array and by year (first) and a rating (second) from unsorted List. Test your methods and explain their time complexity.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