import java.util.*; class Hello{ public static void main( String[] args) { String name; Scanner scan = new Scanner( System.in ); System.out.print( "What's your name? "); name = scan.next(); System.out.format( "Hi %s!\n", name ); } }
javac Hello.java
javac runs the java compiler. Type java -h to see more options.
The compiler will read and compile the code in Hello.java and produce an executable byte code and store it in a file called Hello.class If you copied and pasted the file properly, the compiler should not produce any errors.
Here's a sample run using the command:
java Hello
What's your name? alex Hi alex!
Add comment block at the beginning of your program, similar to the following:
//===============================================// // Author: your name here // // Date: date last edited here // // Program: Lab 1 assignment // // Description: brief description of the // // assignment here. // //===============================================//
Next, modify the program so that it prints an extra line containing the URL of the class website.
For example, "The CMPS12A webpage is: _______."
submit cmps012a-ap.w15 lab1 Hello.java
This command copies Hello.java to a location which the Professor and TAs will have access to. Generally speaking, lab1 is the name of the assignment you are submitting and Hello.java is the name of the file that you want to submit.Log onto unix.ic.ucsc.edu with SSH.
Verify that your code compiles and runs on unix.ic.ucsc.edu.
Help using SSH.Submit the Hello.java file as described above.
Also, if you are working on a Windows machine you should know that Windows and Unix use different newline characters. (see FAQ)
General notes ------------- 100 Perfect score 75 No comment block or no URL 50 No comment block and no URL, or compiles but does not run 25 Does not compile e.g. empty file, wrong file name, etc. 0 No submit The grading for this lab assignment is based on these 5 scores. You should still follow good programming practices. Who Will Grade What: -------------------- Ryan : aalkahel - dlopez8 Kara : dlskilli - jssorens Derek : jtorre34 - romarks Eitan : rpickett - zwang58