Tutorial 1 Lecturer: Steve Bellantoni Tutor: Andria Hunter ========== 980921 @10am (RW229) @1pm (EM108) CSC108, Fall 1998 Tutorial notes, T1 ================================================================== Topics: - Intro - CDF-FC - Java WorkShop 2.0 - Java Example Program Announce: - Reading assignment is 3.1 and 3.2. - Reading last week was 1.2 and 2.1. - Also look at the rest of Chapter 2. Purpose of Tutorials: - not to present new material - bring your questions - we'll go over examples CDF-PC: Login: CTRL-ALT-DELETE User name: f108hunt Password: ********* Domain: CDF-PC Ok Web & News: Course web page Start -> Netscape -> Dept of C.S. -> CDF-PC -> 108 page Tutorial web page http://www.cs.toronto.edu/~andria/csc/108f98/ - marks - tutorial notes - old tests Can access the course web page through Netscape. E-mail: Your address will be f108hunt@cdfpc.toronto.edu Look for the mail program under Start->Programs. Your files: H: Space on the hard drive for you. When you return to the lab, your files will still be here. A: Floppy disk drive. Use to make backups. To browse your files, click with the right mouse button on Start and select "Explore..." Java WorkShop Overview: Start->Java WorkShop When you start up, there are two windows. You can close the Startup window right away because you don't really need this window. On the remaining window there are a number of icons along the top. The icons that are most important are "Build," "Run," "Projects," and "Save." At the bottom of this window is a big box that will be used to edit your programs. "Projects" - use to start up the project manager. You'll specify the files that you'll be using, and you'll read in existing files from this window. "Save" - after you make changes to your program in the edit window, click this to save it on disk. "Build" - after your program is complete, click this to compile your program (convert to machine code). "Run" - after you have compiled your program, click this to run your program. A run window will appear. Project Manager Window: My Portfolios |-> personal (this is a portfolio) | | | |-> Checkers (this is a project) | | |-> Checkers.java (this is a file) | | | |-> CardFile | |-> JellyBeanExample | |-> PerformanceExample | |-> andria (this is a portfolio) | |-> Applications |-> ApplicationCentre.java |-> Applications.java |-> Student.java To create portfolio "andria" - File->New->Portfolio... To create project "Applications" (name of class with main method) - File->New->Project... Project name: Applications o standalone o No GUI next> Where should java store files? [You can use the default directory, or you can substitute your name after /jws. E.g., H:\jws\andria\Applications] finish You will have an extra Applications.java template file that you'll need to remove as follows: - File->Remove File From Project To bring in 3 class files that you've saved from the web page - File->Add->File... select it from wherever you downloaded it on H: drive For more help: - read "how to prepare programs on the C.S. PC facility" - see a tutor during the office hours - note: don't wait ... assignment 1 is hard! So start getting comfortable with the environment right away! Logout/Change Password: CTRL-ALT-DELETE - select "logout" - select "change password" Printing There is no printing program available through Java WorkShop. There will be a program installed on the CDF-PC computers that you can use to print your java files. Sample Java Program: // CSC108 Tutorial 1 Example // Name: Iam Me Student ID: 555555555 // Tutor: Andria Hunter Prof: Steve Bellantoni // // Program Description: This program adds two numbers together // and prints out the result. import java.io.*; class AddUp { // Main method to add numbers and display result. public static void main (String[] args) throws IOException { // Declare stdin so data can be read from input. DataInputStream stdin = new DataInputStream (System.in); int first = 5; // Store the first number int second = 13; // Store the second number int sum = first = second; // Store the sum // Display the sum with an output label System.out.println ("Add up result is " + sum + "."); } }