2016-09-13 HW

posted Sep 13, 2016, 6:44 AM by Samuel Konstantinovich   [ updated Sep 19, 2016, 6:11 AM ]

Goal: Course overview + Your terminal fu is no good here...


lisa.stuy.edu 149.89.160.100
homer.stuy.edu 149.89.150.100
bart.stuy.edu 149.89.151.100
marge.stuy.edu 149.89.161.100

307:   149.89.150.xxx  
      cslab1-1 ... cslab1-30  where xxx is 101-130

325:   149.89.151.xxx  
    cslab2-1 ... cslab2-30  where xxx is 101-130

251:   149.89.160.xxx  
    cslab3-1 ... cslab3-31  where xxx is 101-131

451:   149.89.161.xxx  
    cslab4-1 ... cslab4-32  where xxx is 101-132

SSH to any host with a final number 101-105 using its ip address
 *nix command: ssh user@host
 Win: puTTY

File transfer (also to hosts from 101-105) uses SFTP: Filezilla  (port 22)

Resources:
Very Basic Linux Tutorial for n00bs and forgetful people:  https://www.digitalocean.com/community/articles/an-introduction-to-linux-basics

More detailed Linux/Unix tutorial:

Java code for reference:

EXAMPLE 1:

file: helloworld.java

public class helloworld{
    public static void main(String[]args){
        System.out.println("Hello world");
    }
}

EXAMPLE 2 (2 files)
file: Demo.java

public class Demo{
    public static void main(String[]args){
        something X,bob;
    
        //create 2 instances of the something class (instantiate)
        X=new something();
        bob=new something();

        //manually set the variables inside of the X object:
        X.a=3;
        X.b=-2;

        //call the method 'print' from in the something class
        X.print();
        bob.print();
    
    }
}

file: something.java

public class something{
    int a,b;
    public something(){
    }

    public void print(){
        System.out.println(a+","+b);
    }
}



HW:
1. Install JDK 7 (link on main course page)
2. (windows only)
https://java.com/en/download/help/path.xml     
I needed to add this to my path but your location may be slightly different:
  C:\Program Files\Java\jdk1.7.0_79\bin\
SUPER IMPORTANT: You have to ADD TO your path, not replace it. Look at the divider (usually semicolons)
3. Test the JDK by running this on a terminal:  
javac -version
4. Paste the following into HelloWorld.java :
public class HelloWorld{
    public static void main(String[]args){
        System.out.println("Hello, my name is Inigo Montoya, You killed my");
        System.out.println("father, prepare to die!");
    }
}
5. Open a terminal and cd into the same directory as your file, then run the commands:
javac HelloWorld.java
java HelloWorld

Comments