Question

In: Computer Science

Linux Question: you will practice on creating and editing a text file by VI. How to:...

Linux Question: you will practice on creating and editing a text file by VI.

How to:

  1. Install JDK 1.8 by the following command:

$ sudo yum    –y    install    java-1.8.0-openjdk-devel.x86_64

  1. Use VI to create a file “YourFirstNameHomework.java” (e.g., “MollyHomework.java”) and add the following contents into it. (grading details: file name format:10 pts, a screenshot of the file content in the VI environment: 10pts, paragraphs: 10pts, empty lines and indentations: 10, text: 10pts)

Here's the code

import java.util.Scanner; // Import the Scanner class

class MollyHomework {

public static void main(String[] args) {

    Scanner myObj = new Scanner(System.in); // Create a Scanner object

    System.out.println("Enter your first name");

    String fName = myObj.nextLine(); // Read user input of the first name

    System.out.println("Enter your last name");

    String lName = myObj.nextLine(); // Read user input of the last name

    System.out.println("Hello " + fName + “ “ + lName); // Output user input   }

}

3.To compile the above java code, run the following command (you need to use your java file name):

$ javac MollyHomework.java

4. To execute the java program, run the following command

$ java MollyHomework

Question:

Describe how you created above file and its contents in VI.

  1. Bash/VI commands: 20pts;
  2. Non-brute-force solution: 10pts).

Note: Brute-force solution means that entering characters one by one.

*Show how the code looks or how you got it to work in your linux machine

Solutions

Expert Solution

Type the above program in notepad or just copy it and then paste it in VI editor with the following method.

the first type I for insert text.

Move the cursor to the end of what you want to cut. Press d to cut (or y to copy). Move to where you would like to paste. Press P to paste before the cursor, or p to paste after.

if you have any doubt then please ask me without any hesitation in the comment section below, if you like my answer then please thumbs up for the answer, before giving thumbs down please discuss the question it may possible that we may understand the question in a different way and I can edit and change the answers if you argue, thanks :)


Related Solutions

Linux Question: Describe how you created above file and its contents in VI. a) Bash/VI commands:...
Linux Question: Describe how you created above file and its contents in VI. a) Bash/VI commands: 20pts; b) Non-brute-force solution: 10pts). Note: Brute-force solution means that entering characters one by one Install JDK 1.8 by the following command: $ sudo dnf –y install java-1.8.0-openjdk-devel.x86_64 Use VI to create a file “YourFirstNameHomework.java” (e.g., “MollyHomework.java”) and add the following contents into it. (grading details: file name format:10 pts, a screenshot of the file content in the VI environment: 10pts, paragraphs: 10pts, empty...
In linux , Using a simple text editor, create a text file with the following name...
In linux , Using a simple text editor, create a text file with the following name "Test" and content: GNU GENERAL PUBLIC LICENSE The GNU General Public License is a free, copy left license for the GNU General Public License is intended to guarantee your freedom to GNU General Public License for most of our software; it applies … 2-Write the command to create the text file. 3-Print the file permissions. 4-Create a directory named "361" 5-Copy file "Test" to...
Use Vi text editor or ATOM to create a bash script file. Use the file name...
Use Vi text editor or ATOM to create a bash script file. Use the file name ayaan.sh. The script when ran it will execute the following commands all at once as script. Test your script file make sure it works. Here is the list of actions the script will do: It will create the following directory structure data2/new2/mondaynews off your home directory. inside the mondaynews, create 4 files sports.txt, baseball.txt, file1.txt and file2.txt. Make sure file1.txt and file2.txt are hidden...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would...
Unix / Linux 6. vi editor: In vi command mode, what are the keystrokes you would type to... Quit the vi editor and save any changes? 7. C language source files, by convention, have the suffix ".c". The associated "header" files have the suffix ".h". What is the command to perform the following task: List all the C source and C header files in the current directory. [Hidden files may remain hidden.] 8. C language source files, by convention, have...
Ubuntu Linux HW5: text processing; scripting 1. Write a Linux command to rewrite the /var/passwd file...
Ubuntu Linux HW5: text processing; scripting 1. Write a Linux command to rewrite the /var/passwd file to have a tab for each delimiter ':'. Hint: use tr 2. Write a Linux command to extract the user names and sort them. Hint: use cut 3. Write a for loop to to display a time table, e.g., 17 x 1 = 17; 17 x 2 = 34; etc., as follows: 17 x 1 = 17 17 x 2 = 34 17 x...
java question: How would you be able to store a matrix from a text file into...
java question: How would you be able to store a matrix from a text file into a linked or doubly linked list, if you cannot use 2D arrays? input example: 1 2 3 4 1 3 2 4 4 2 3 1
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name...
PLEASE USE LINUX/UNIX 1.Use either pico, vi, or cat to create the following file and name it as “mysedfile”: Name Class1 Class2 Class3 Tom 92 94 88 Nancy 91 85 95 Lisa 99 77 96 Jerry 84 98 90 2. Please use sed command(s) to complete the following tasks. display Tom’s record. display Lisa’s record. display both Tom’s and Lisa’s records. remove the blank line(s) from “mysedfile.” replace all the digits with *.
how to count the word of occurance in the text file example input text file :...
how to count the word of occurance in the text file example input text file : "test1.txt hello : 1 good : 1 morning: 1 how : 1 are : 2 you : 2 good : 1 example output text file : "test2.txt" 1 : 4 2 : 2 3 : 0 4 : 0 5 : 0
Question As a marketing planner, you need to practice creating your own marketing plan. You are...
Question As a marketing planner, you need to practice creating your own marketing plan. You are required to design a marketing plan for your organization focusing on the following sections: Executive summary - Business Description Market summary which includes: Quantitative analysis: target markets, geography, demographics, consumer behavior, competition analysis, Qualitative analysis: market trends, perceptions towards brands, companies, images, packaging. SWOT analysis Competition Value Proposition Marketing strategy which includes: Mission, mission, values Objectives based on marketing plan Sales forecast Financial objectives...
The vi text editor can be a bit challenging to use at first, but once you...
The vi text editor can be a bit challenging to use at first, but once you have familiarized yourself with how it works you will find it an efficient way to create and edit text files in Linux, and UNIX as well. The key thing to remember is that vi has two operational modes: insert mode and command mode. In insert mode, everything you type is entered into your file. You can use the backspace, delete and the arrow keys....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT