Tutorial 1 Lecturer: Craig MacDonald Tutorial: Mon@10:10am 970915 ========== CSC 108, Fall 1997 Tutorial notes, T1 ========================================================================== Go slowly and encourage questions at this point. Get them able to log in. In lecture I am only up to slide 10. See my section web page. SUMMARY OF TOPICS o basic system stuff o basic internet stuff o basic environment stuff. o "how to run programs" part o questions on assnt 1. o How to get A+ BASIC SYSTEM STUFF o Where are keys: delete/del/arrow/Ctrl/Alt, how to log in. - Login : f108xxxx - Passwd : [student number] - no blanks in student number, password - don't mix up O and 0, and l and 1 - First change password, Log off o double-click on icons: QUIT Alt-F4 (check this yourself) o disk stuff: Format, Make backups 3 1/2 (2DD or HD) INTERNET, EMAIL, NEWS, WWW o easy: point and click, dialogue boxes, etc o What are email, news and www? o What are they appropriate for o (email is more private; news is public.) o Info for you about these: - you can read fairly local newsgroups and www pages - email is not restricted at all ENVIRONMENT STUFF o most basic stuff about the environment creating a file: program or data compiling a program executing a program - how to get in: - moving: arrow keys, mouse, side bar - File Edit Run ... Help The environment can be used to create files that contain anything: programs, data files, recipes or email. HOW TO RUN A PROGRAM o to do assignment 1. /* Program to square a number from a command line argument */ import java.io.*; class SquareNumber { public static void main (String[] args) { double num; // defines the type of num // define and create a new object of class Double. Double has a // constructor taking a string argument. Double numD = new Double(args[0]); // the doubleValue class method of the Double class returns the // primitive double value field. num = numD.doubleValue(); // Could do the above in one statement. // num = new Double(args[0]).doubleValue(); System.out.println(num + " squared is " + num*num); int i = (int)(num*num); // casting to integer System.out.println("the square truncated is " + i); } } /* OUTPUT java SquareNumber 3.3 3.3 squared is 10.889999999999999 the square truncated is 10 */ o handout "Doing your work in csc108F" o under "How to prepare your assignments" available SF2304 or 108 folder in Engi- neering library. o MOST BASIC WAY TO RUN PROGRAMS - input from keyboard and output to screen - redirecting from file, and/or to file java MyClass < infile > outfile - an input file is just another file. - an output file is just another file. - input and output files can be printed. o questions on assnt 1. o Login : a108xxxx o Passwd : [Student number] o [open editor or Visual Age for Java] o [type in program] o [click on FILE] & [SAVE AS] dialogue box o create data file same way then quit