Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Create a folder called pgm1 2) Using a LINUX EDITOR, in your pgm1 folder, cre

ID: 3880471 • Letter: 1

Question

1) Create a folder called pgm1 2) Using a LINUX EDITOR, in your pgm1 folder, create a Java program named: Your lastName, firstLetterOfYourFirstName, pgm1U.java that will do the following: Start here 3) From your program's main method, passing your name, call a new method named: processUbuntu 4) At the processUbuntu method, call a new method named printMyUbuntuName, passing the data received from the main method 5) At the printMyUbuntuName method display the data received from the processUbuntu method using the "System.out.printf" java method.

Explanation / Answer

In the LINUX editor, these arre the steps that you can follow -

1. Create the folder prog1 using mkdir command:
mkdir prog1

2. Change directory and get into the prog1 folder using cd command:
cd prog1

3. Using vi editor you can create the java file in the folder and start writing the code there. Use the decription given to chose the file name.
vi abcpgm1U.java

4. Press i to start inserting code into the file abcpgm1U.java.

5. The code below would suit the requirement given in the question.
NOTE: The string John would be the name to be printed by the code.

public class MyClass {
static void printMyUbuntuName(String name){
System.out.printf(name);
}
static void processUbuntu(String name){
printMyUbuntuName(name);
}
public static void main(String args[]) {
processUbuntu("John");
}
}

6. Hit Escape key.

7. Type :w abcpgm1U.java to save the code

8. Type :q to quit

9. In the folder pgm1, compile the java program using the command:
javac abcpgm1U.java

10. Execute the generated class file as:
java MyClass