IMG_7064
.png
keyboard_arrow_up
School
Macomb Community College *
*We aren’t endorsed by this school
Course
1710
Subject
Computer Science
Date
Jul 2, 2024
Type
png
Pages
1
Uploaded by AgentTeamGiraffe39
158 Chapter 8: Specifying Instructions to the Shell 0 15 MINUTES Lab Exercise 8.04: Writing Wildcard Expressions There are several hundred files on LaTrina’s web site. Periodically, she needs to modify entire groups of files. For example, she often updates the .htm files. Before updating the files, she copies the files into a backup directory. She currently does this one file at a time and would like a faster method. Wildcards will allow her to access and manipulate large numbers of files at one time. Learning Objectives In this lab, you will write wildcard expressions. By the end of this lab, you'll be able to: . Use the * (asterisk) operator to write expressions ® Use the ? (question mark) operator to write expressions e Use the [ ] (brackets) operator to write expressions Lab Materials and Setup The materials you need for this lab are: ® Pencil and paper e (Optional) Computer with Red Hat Linux 7.3 installed Getting Down to Business You will practice writing wildcard expressions in the following tables. In the first table, you will describe the command and list possible results. In the second table, you will create com- mands to solve the problem. In each case, an example is provided for guidance. You will have to apply the knowledge that you acquired in the Introduction to UNIX and Linux textbook by John Muster (McGraw-Hill/Osborne, 2002) for working with wildcards. Command Description of Wildcard Example Files 1s a* All files that begin with a apple, Andrew, a.out 1s duke*.doc 1s *.jpg
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Instructions
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points.
Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%,…
arrow_forward
File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will bea version of the first file, but written in a secret code.Although there are complex encryption techniques, you should come up with a simple one of your own. For example, you could read the first file one character at a time, and add 10 to the character code of each character before it is written to the second file.
Write a program that decrypts the file produced by the program in above.The decryption program should read the contents of the coded file, restore the data to its original state, and write it to another file.
arrow_forward
Simple Encryption. Write a java program that reads from a file specified by the user and encrypt the content of the file using a simple shifting technique. Also, ask the user to input the shift size. Output the encrypted message to another file whose filename is also provided by the user.
For example,
Shift size: 1
Message read from the file: Hello Encrypted message: Ifmmp
arrow_forward
If wrong answer this time will downvote it
Create a class with a static main that tests the ability to resolve and print a Path:
• Create an instance of a FileSystem class.
• Resolve an instance of a Path interface from a directory path and filename.
• Print the constructed Path with System.out.println() method.
2. Create a class with a static main that tests the ability to resolve and print a Path:
• Create an array of Path class.
• Instantiate instances of Path with absolute and relative paths.
• Print the constructed elements of the array of Path class with System.out.println() method.
3. Create a class to test serialisation class that implements serializable, it should implement the following:
• A static void method that serialises an object.
• A static void method that deserializes an object.
• A static main method that tests the two by moving an object from one to the other
arrow_forward
My IDE is BlueJ, and when I run the main method it does not write to a text file.
arrow_forward
Correct the code:
1. import java.io.File; // Import the File classimport java.io.IOException; // Import the IOException class to handle errorspublic class CreateFile {public static void main(String[] args) {try {File myObj = File("filename.txt");if (myObj.createNewFile() {System.out.println("File created: " + getName());} else {System.out.println("File already exists.");}} catch (IOException) {System.out.println("An error occurred.");}}}Output:File created: filename.txt
2. import java.io.File; // Import the File classimport java.io.FileNotFoundException; // Import this class to handle errorsimport java.util.Scanner; // Import the Scanner class to read text filespublic class ReadFile {public static void main(String[] args) {myObj = new File("filename.txt");Scanner myReader = Scanner(myObj);while (myReader.hasNextLine()) {String data =nextLine();System.out.println(data);
4}myReader.close();catch (e) {System.out.println("An error occurred.");e.printStackTrace();}}}Output:Files in…
arrow_forward
CODE ZSAP the helom.
arrow_forward
Project One (1): Image
2 Imagguil@compute-/private/courses/es2211/W21/assignments/asn3/p.
fimagguilecompute projijs ./proji
Enter values for Layers, Rows, Columns (elements in each row): 234
Original Matrix
Layer 1
(1) 71
72
57
48
49
(2 ) 99
layers
57
( 3 ) 12
58
57
18
23
prompt
Layer 2
(1) se
( 2) 30
(3) 94
77
83
12
99
90
42
84
80
96
row
number
Enter values for Layers, Rows, Columns (elements in each row): e e e
FINISHED
(Imagguilecompute projijs
(Imagguilecompute projijs
Code for generating random integers:
int x, m = 100;
time_t t;
srand ( (unsigned) time (st));
x = (rand () % m) +1;
where:
time_t is defined in the C library of time.h
m is range. In this case 100 signifies the range of 0 to 99, so we add I to the result.
(note: m will vary in the second project to match to the matrix size.)
arrow_forward
In Exercise 11.20, you created a Connect Four game that enables two players to play the game on the console. Rewrite the program using a GUI program, as shown in Figure 12.25. The program enables two players to place red and yellow disks in turn. To place a disk, the player needs to click on an available cell. An available cell is unoccupied and its downward neighbor is occupied. The program flashes the four winning cells if a player wins, and reports no winners if all cells are occupied with no winners.
arrow_forward
Write a Java GUI program using BufferedReader that asks the user to input the file to be opened. If said file exists, the program shows its first line text. It is given that you have myFile.txt in your working directory with the following text.
Sample Output:
arrow_forward
create a java method named clearDirectory(String name)a. This method should delete all of the files in the directory with the specifiedname. Hint: read the java.io.File documentation to see how you might list the files in a directory and then delete them.b. If a file cannot be deleted for some reason, throw an IOException with anappropriate message including the absolute path to the file.c. Rethrow any exceptions that might occur.
arrow_forward
Can you plaese do these questions for me
Our users do not want to have to re-enter the price levels each time the app starts.
Therefor, we need to save the price levels to a file on disk – called levelsFile - and populate the levelsList with the file’s items when the app starts.
Also, every time the user manipulates the values in levelsList, levelsFile needs to be updated accordingly. The easiest way is not to update the file, but to simply override it (create a new file) with the new values in levelsList (each time the user manipulates items in the list).
Two new methods need to be created in the PriceChecker class. They are readLevelsFromFile() and writeLevelsToFile(). And then the Main Code Section must also be updated to use these methods in the object.
Note: The changes required to the Main Code Section are supplied on the next slide, but you need to complete the skeleton code of the two newly mentioned methods (supplied on subsequent slides).
Add the purple code to your…
arrow_forward
this is a java program code please do the code what in the question says and please follow what in the question says and dont copy or plagarise from other sources
arrow_forward
Suppose you have Java source files under the directorieschapter1, chapter2, . . . , chapter34. Write a program to insert thestatement package chapteri; as the first line for each Java source file underthe directory chapteri. Suppose chapter1, chapter2, . . . , chapter34are under the root directory srcRootDirectory. The root directoryandchapteridirectory may contain other folders and files. Use the followingcommand to run the program:java Exercise12_18 srcRootDirectory
arrow_forward
Build a csharp application that reads from a file and print out the contents of that file in another files words by words (i.e. one word each line)
arrow_forward
You will develop a client side and a Servlet program that will work with a database.
1. The client (front end) should have a title "NJIT Credit Union", centered.
2. The client should have a background color.
3. The client should have a text field with label 'UserID' where user will enter userID
(integer) and a Submit button with text "Submit".
4. An unsuccessful authentication should have a message printed on the screen, in red,
stating that "Your authentication has failed, please try again.” (no pop up message).
At this point the text field should get cleared and ready to accept a new input. Your
program should not exit.
5. A successful authentication should be followed by a message on the screen, in green,
stating that "Your authentication is successful" (no pop up message).
6. There should be two other text boxes with label "Deposit" and "Withdraw" where
user will enter an amount (you should accommodate for decimals). These two text
boxes should only be enabled after successful…
arrow_forward
Text messaging is a popular means of communication. Many abbreviations are in common use but are not appropriate for formal communication. Suppose the abbreviations are stored, one to a line, in a text file named abbreviations.txt. For example, the file might contain these lines
arrow_forward
Your ReadRoomFile program reads a room file. Is it possible to tell how many rooms are in the file from the file size? Explain why or why not?
arrow_forward
Please help me with this
Create an unbreakable encryption and decryption program using java. Then create a GUI txt file. But use your own ideas. More information is down below
arrow_forward
write java code
The wise university like to manage Student records uSig a desktop application. The program's main Window includes two options (can be implemented Lßing buttons Ot Similar components). These options are: add a new record and display search and edit records. To implement such an application. you need to implement the following: Create three frames, one as the main application frame Frame) and two hidden frames (add New Record and Display, search and Edit record) that are displayed only through events implemented the mainframe (two buttons). The components Of the secondary windows are follows: Add New Record: use proper components to allow to add the fo"owing information for each student (Name. Gender, University ID. National ID. Nationality, Tawjihi Graduate Year, Major, Academic Department, and Faculty). Note; are not always the right option user inputs When there options for some inputs. Display, and Edit Record: use Components to the user to display the students'…
arrow_forward
HEMIP INTEGER THROUGH CODEV.
arrow_forward
Write an address book program that stores your contacts' names and their email addresses. The names and email addresses are originally stored in a file called phonebook.in, in the format:
Harry Pottertheboywholived@hogwarts.eduHermione Grangerbrightestwitch@hogwarts.eduRon Weasleyroonilwazlib@hogwarts.eduDraco Malfoymyfatherwillhearaboutthis@hogwarts.eduSeverus Snapehalfbloodprince@hogwarts.eduAlbus Dumbledorealasearwax@hogwarts.edu
Your program should read from the file, storing the names and corresponding email addresses in a dictionary as key-value pairs. Then, the program should display a menu that lets the user enter the numbers 1 through 5, each corresponding to a different menu item:
1) look up an email address2) add a new name and email address3) change an email address4) delete a name and email address5) save address book and exit
When the user enters 1, the program should prompt them for a name, and then print the corresponding email address. If there is no dictionary entry…
arrow_forward
The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points.
Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%, D; and…
arrow_forward
Create a new program called Hamlet1.
Program should read, count and print the total number of tokens in the “hamlet.txt” file.
Use the hamlet text file provided. Follow correct steps to download and save file.
Answer: 31956
arrow_forward
There might be two files with the same name in your archive.
Take this directory as an example of your home. Follow these instructions to copy the file called florence into the Proposals folder in your home directory.
arrow_forward
Our users do not want to have to re-enter the price levels each time the app starts. Therefore, we need to save the price levels to a file on disk – called levelsFile - and populate the levelsList with the file’s items when the app starts.
Also, every time the user manipulates the values in levelsList, levelsFile needs to be updated accordingly. The easiest way is not to update the file, but to simply override it (create a new file) with the new values in levelsList (each time the user manipulates items in the list).
Two new methods need to be created in the PriceChecker class. They are readLevelsFromFile() and writeLevelsToFile(). And then the Main Code Section must also be updated to use these methods in the object.
Note: The changes required to the Main Code Section are supplied on the next slide, but you need to complete the skeleton code of the two newly mentioned methods (supplied on subsequent slides).
(code to work on)instructions in pictures
class PriceChecker():
#…
arrow_forward
Using JAVA, Create a File Menu in your GUI Add a file menu to your BulbGUI with options to open any file for reading (and displaying the file as in Project 2), and one to Quit the program. You will need a FileMenuHandler class to handle the events from the FileMenu. Be sure to use getAbsolutePath() when getting the file from the JFileChooser, not getName(). Handle Exceptions Create an exception called IllegalBulbException (by extending IlegalArgumentException as shown in the lecture) and have the constructor of the Bulb throw it. For our purposes, a Bulb is illegal if the wattage is less than 5. Use a try/catch statement to catch this exception in your program, and display the erroneous Bulbs to the console (do not put them in the ArrayList). Use ArrayLists Use an ArrayList to store the unsorted Bulbs. For this project, display only the unsorted bulbs in the GUI. Input file Phillips,1237DF2,100,1200 Phillips,546AHH7,75,900 Phillips,875RTM6,4,750 Cree,14573,65,800 Cree,86545,100,1100…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Related Questions
- Instructions The history teacher at your school needs help in grading a True/False test. The students’ IDs and test answers are stored in a file. The first entry in the file contains answers to the test in the form:TFFTFFTTTTFFTFTFTFTTEvery other entry in the file is the student ID, followed by a blank, followed by the student’s responses. For example, the entry:ABC54301 TFTFTFTT TFTFTFFTTFTindicates that the student ID is ABC54301 and the answer to question 1 is True, the answer to question 2 is False, and so on. This student did not answer question 9. The exam has 20 questions, and the class has more than 150 students. Each correct answer is awarded two points, each wrong answer gets one point deducted, and no answer gets zero points. Write a program that processes the test data. The output should be the student’s ID, followed by the answers, followed by the test score, followed by the test grade. Assume the following grade scale:90%–100%, A; 80%–89.99%, B; 70%–79.99%, C; 60%–69.99%,…arrow_forwardFile encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will bea version of the first file, but written in a secret code.Although there are complex encryption techniques, you should come up with a simple one of your own. For example, you could read the first file one character at a time, and add 10 to the character code of each character before it is written to the second file. Write a program that decrypts the file produced by the program in above.The decryption program should read the contents of the coded file, restore the data to its original state, and write it to another file.arrow_forwardSimple Encryption. Write a java program that reads from a file specified by the user and encrypt the content of the file using a simple shifting technique. Also, ask the user to input the shift size. Output the encrypted message to another file whose filename is also provided by the user. For example, Shift size: 1 Message read from the file: Hello Encrypted message: Ifmmparrow_forward
- If wrong answer this time will downvote it Create a class with a static main that tests the ability to resolve and print a Path: • Create an instance of a FileSystem class. • Resolve an instance of a Path interface from a directory path and filename. • Print the constructed Path with System.out.println() method. 2. Create a class with a static main that tests the ability to resolve and print a Path: • Create an array of Path class. • Instantiate instances of Path with absolute and relative paths. • Print the constructed elements of the array of Path class with System.out.println() method. 3. Create a class to test serialisation class that implements serializable, it should implement the following: • A static void method that serialises an object. • A static void method that deserializes an object. • A static main method that tests the two by moving an object from one to the otherarrow_forwardMy IDE is BlueJ, and when I run the main method it does not write to a text file.arrow_forwardCorrect the code: 1. import java.io.File; // Import the File classimport java.io.IOException; // Import the IOException class to handle errorspublic class CreateFile {public static void main(String[] args) {try {File myObj = File("filename.txt");if (myObj.createNewFile() {System.out.println("File created: " + getName());} else {System.out.println("File already exists.");}} catch (IOException) {System.out.println("An error occurred.");}}}Output:File created: filename.txt 2. import java.io.File; // Import the File classimport java.io.FileNotFoundException; // Import this class to handle errorsimport java.util.Scanner; // Import the Scanner class to read text filespublic class ReadFile {public static void main(String[] args) {myObj = new File("filename.txt");Scanner myReader = Scanner(myObj);while (myReader.hasNextLine()) {String data =nextLine();System.out.println(data); 4}myReader.close();catch (e) {System.out.println("An error occurred.");e.printStackTrace();}}}Output:Files in…arrow_forward
- CODE ZSAP the helom.arrow_forwardProject One (1): Image 2 Imagguil@compute-/private/courses/es2211/W21/assignments/asn3/p. fimagguilecompute projijs ./proji Enter values for Layers, Rows, Columns (elements in each row): 234 Original Matrix Layer 1 (1) 71 72 57 48 49 (2 ) 99 layers 57 ( 3 ) 12 58 57 18 23 prompt Layer 2 (1) se ( 2) 30 (3) 94 77 83 12 99 90 42 84 80 96 row number Enter values for Layers, Rows, Columns (elements in each row): e e e FINISHED (Imagguilecompute projijs (Imagguilecompute projijs Code for generating random integers: int x, m = 100; time_t t; srand ( (unsigned) time (st)); x = (rand () % m) +1; where: time_t is defined in the C library of time.h m is range. In this case 100 signifies the range of 0 to 99, so we add I to the result. (note: m will vary in the second project to match to the matrix size.)arrow_forwardIn Exercise 11.20, you created a Connect Four game that enables two players to play the game on the console. Rewrite the program using a GUI program, as shown in Figure 12.25. The program enables two players to place red and yellow disks in turn. To place a disk, the player needs to click on an available cell. An available cell is unoccupied and its downward neighbor is occupied. The program flashes the four winning cells if a player wins, and reports no winners if all cells are occupied with no winners.arrow_forward
- Write a Java GUI program using BufferedReader that asks the user to input the file to be opened. If said file exists, the program shows its first line text. It is given that you have myFile.txt in your working directory with the following text. Sample Output:arrow_forwardcreate a java method named clearDirectory(String name)a. This method should delete all of the files in the directory with the specifiedname. Hint: read the java.io.File documentation to see how you might list the files in a directory and then delete them.b. If a file cannot be deleted for some reason, throw an IOException with anappropriate message including the absolute path to the file.c. Rethrow any exceptions that might occur.arrow_forwardCan you plaese do these questions for me Our users do not want to have to re-enter the price levels each time the app starts. Therefor, we need to save the price levels to a file on disk – called levelsFile - and populate the levelsList with the file’s items when the app starts. Also, every time the user manipulates the values in levelsList, levelsFile needs to be updated accordingly. The easiest way is not to update the file, but to simply override it (create a new file) with the new values in levelsList (each time the user manipulates items in the list). Two new methods need to be created in the PriceChecker class. They are readLevelsFromFile() and writeLevelsToFile(). And then the Main Code Section must also be updated to use these methods in the object. Note: The changes required to the Main Code Section are supplied on the next slide, but you need to complete the skeleton code of the two newly mentioned methods (supplied on subsequent slides). Add the purple code to your…arrow_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