1 / 11

CSCI S-1 Section 3

CSCI S-1 Section 3. Deadlines for Homework 2. Problems 1-8 in Parts C and D Friday, July 3, 17:00 EST Parts E and F Tuesday, July 7, 17:00 EST. Connecting to your FAS account (nice.fas.harvard.edu). Mac OS: Terminal http :// isites.harvard.edu/fs/docs/icb.topic576155.files/terminal.pdf

Download Presentation

CSCI S-1 Section 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI S-1Section 3

  2. Deadlines for Homework 2 • Problems 1-8 in Parts C and D • Friday, July 3, 17:00 EST • Parts E and F • Tuesday, July 7, 17:00 EST

  3. Connecting to your FAS account (nice.fas.harvard.edu) • Mac OS: Terminal • http://isites.harvard.edu/fs/docs/icb.topic576155.files/terminal.pdf • Windows: SecureCRT • http://isites.harvard.edu/fs/docs/icb.topic576155.files/securecrt.pdf • Downloads site • http://www.fas-it/fas.harvard.edu/

  4. Getting around in Linuxhttp://isites.harvard.edu/fs/docs/icb.topic576155.files/UNIX_commands_reference_card.pdf • Listing files • Changing directories • Making directories • Removing directories • Removing files • Copying files • Moving files • Print file to monitor • Your present working directory • ls • cd • mkdir • rmdir • rm • cp • mv • cat • pwd

  5. Using Nano • To edit a textfile • nano filename • Inside nano • control+O to save • control+X to exit • additional commands explained in the help at the bottom of the screen.

  6. Submitting Homework • Setup your account by running ~libs1/pub/bin/s1setup • Execute the logout command by typing logout and then enter • Login again and make a directory to hold all of your homework • mkdir s1 • Get into s1 • cd s1 • Make a directory for parts C, D (ps21) and E, F (ps22) • mkdir ps21 • mkdir ps22 • Test-drive the submit tool by submitting a temporary part 1 • s1submit ps21 • NB: Your last submission is the one timestamped and graded.

  7. Java Exercises Type up this simple program in nano and save it as section3.java class section3 { public static void main(String [] args) { System.out.println("Hello!"); } } Compile it: javac section3.java Run it: java section3

  8. Java Exercises Write a java program that will print the following H E L L O \ \ _ " ." JAVA Programming class section3a { public static void main(String [] args) { System.out.println("H E L L O\\\\_ \" .\""); System.out.println("JAVA"); System.out.println("Programming"); } }

  9. Java Exercises Rewrite the program using one method to print each line class section3b { static void firstLine() { System.out.println("H E L L O\\\\_ \" .\""); } static void secondLine() { System.out.println("JAVA"); } … public static void main(String [] args) { firstLine(); secondLine(); thirdLine(); } }

  10. Understanding Variable Scope class section3c { static int x, y, z; static void first() { int x, y; x = 0; y = 1; System.out.println("x = " + x + " , y = " + y + " z = " + z); } static void second() { int z; y = 7; z = 1; System.out.println("x = " + x + " , y = " + y + " z = " + z); } static void third() { int y; x = 7; y = 1; System.out.println("x = " + x + " , y = " + y + " z = " + z); } public static void main(String [] args) { x = 2; y = 2; z = 3; first(); second(); third(); } }

  11. Understanding Variable Scope (cont) class section3c { … public static void main(String [] args) { x = 2; y = 2; z = 3; System.out.println("x = " + x + " , y = " + y + " z = " + z); first(); second(); third(); System.out.println("x = " + x + " , y = " + y + " z = " + z); } } x = 2 , y = 2 z = 3 x = 0 , y = 1 z = 3 x = 2 , y = 7 z = 1 x = 7 , y = 1 z = 3 x = 7 , y = 7 z = 3

More Related