Howdy. 

We played the https://www.youtube.com/watch?v=qtevzdt4-Kg clip first. 

Someone asked me if we can determine who has and who hasn't silo accounts. 

I refer you to the finger command: 

-bash-4.1$ finger wu94
Login: wu94                             Name: Wenhao Wu
Directory: /u/wu94                      Shell: /bin/bash
Never logged in.
No mail.
No Plan.
-bash-4.1$

Here's what it looks when the user doesn't exist:

-bash-4.1$ finger lbird
finger: lbird: no such user.
-bash-4.1$

And then we gave you a problem: 

Please write code for a Java program that produces
one of the following three outputs: 

Output one: 

How are you?

Output one:

  +-----+
  | o o |
  |  <  |
  | --- |
  +-----+ 

Output three: 

            //  \\
           _\\()//_
          / //  \\ \
           | \__/ |


You have two options: 

(a) work on silo
(b) use DrJava

So I download the DrJava software and develop: 

class One {
  public static void main(String[] args) {
    System.out.println( "How are you?" ); 
  }
}

I run it and it does:

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run One
How are you?


If I want to print some spaces: 

class One {
  public static void main(String[] args) {
    System.out.println( "            " ); // prints 12 spaces 
  }
}

Notice the comment. 

Next we print a special character:

class One {
  public static void main(String[] args) {
    System.out.println( "(      \"      )" ); // prints 6 spaces a " and 6 more spaces
  }
}

Here's how this runs: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run One
(      "      )


"What about the backslash?" says Caige.

class One {
  public static void main(String[] args) {
    System.out.println( "\" ); 
  }
}

Notice that the error message may be intimidating:

3 errors found:
File: C:\Users\dgerman\Desktop\One.java  [line: 3]
Error: unclosed string literal
File: C:\Users\dgerman\Desktop\One.java  [line: 3]
Error: ';' expected
File: C:\Users\dgerman\Desktop\One.java  [line: 5]
Error: reached end of file while parsing

Protect backslash with backslash:

class One {
  public static void main(String[] args) {
    System.out.println( "\\" ); 
  }
}

Here's the proof: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop
> run One
\


Now let's write a more complex program:

import java.util.Scanner; 

class Two {
  public static void main(String[] args) {
    System.out.print("What's your name? ");  
    String name; 
    Scanner in = new Scanner(System.in); 
    name = in.nextLine(); 
    System.out.println("How old are you, " + name + "?"); 
  }
}

This program needs to be finished in lab. 

It asks the user for her/his name.

It reads the name, then uses it to ask a second question. 

Read more in the notes posted for 0930am class. 

--

End of lecture. 

Wonyong wants to know how you can sign up for a silo account? 

I say: what's your username. He says: woha

I check: 

-bash-4.1$ finger woha
Login: woha                             Name: Wonyong Ha
Directory: /u/woha                      Shell: /bin/bash
Never logged in.
No mail.
No Plan.
-bash-4.1$

He already has an account. 

--