In your Ubuntu VM do the following: 1) Create a folder called pgm1 2) Move into
ID: 3742583 • Letter: I
Question
In your Ubuntu VM do the following: 1) Create a folder called pgm1 2) Move into the pgm1 folder 3) Using a linux editor create a Java program that from the main method will call a new method named: processUbuntu 4) At the processUbunt method, call another new method named printMyUbuntuName passing your name. 5) At the printMyUbuntuName method display the data received from the processUbuntu method using the +systen. eut.printi java comand as shon in clas. In your Windows VM do the following: 1) Create a folder called pgm1 2) Move into the pgm1 folder 3) Using a windows editor create a Java program that from the main method will call two methods: 4) welcome and myNamels 5) At the welcome method display: Welcome to OS for IT, using the "System.out.printf" java method. 6) At the myNameIs method display your full name, using the "System.out.printf" java methodExplanation / Answer
1. mkdir pgm1
2. cd pgm1
3. gedit test.java
paste the following code in the editor
import java.util.Scanner; //LINE NUMBER 1
public class Test
{
public static void printMyUbuntuName(String name){
System.out.printf(name);
}
public static void processUbuntu()
{
printMyUbuntuName("Charlie");
}
public static void main(String[] args)
{
processUbuntu();
}
}
Windows VM Solution
import java.util.Scanner; //LINE NUMBER 1
public class Test
{
public static void myNameIs(){
System.out.printf("Charlie Anderson");
}
public static void welcome()
{
System.out.printf("Welcome to OS for IT ");
}
public static void main(String[] args)
{
welcome();
myNameIs();
}
}