cc8088949c7492162177f2415ae3e74c.ppt
- Количество слайдов: 13
COMP 2011 Data Organisation 2005 Session 1 Lecturer: Alan Blair Head Tutor: Loc Huynh Guest Lecturer: Prof. Norman Foo March 2005 2011 Overview 1
Prerequisites for 2011 COMP 1011 Computing 1 A n Haskell n structured problem decomposition n abstract data types COMP 1021 Computing 1 B n procedural programming with C n control flow (if, for, while, switch) March 2005 2011 Overview 2
Resources Textbook n Data Structures and Algorithms in Java (3 rd Ed. ) by Goodrich & Tamassia www. cse. unsw. edu. au/~cs 2011 n n n lecture slides, announcements links to Java API assignments, tutorial exercises Other Reference Books n n n Java Programming Language (3 rd Ed. ) Core Java 2 Java in a Nutshell March 2005 2011 Overview 3
Syllabus Java & Object-Oriented Programming Analysis of Algorithms Stacks, Queues, Trees Heaps, Hash Tables, Search Trees Sorting Algorithms Text Processing Graphs March 2005 2011 Overview 4
Assessment 3 Assignments (40%) Exam (60%) to pass the course you must achieve n n at least 20 out of 60 for the exam at least 50 out of 100 overall March 2005 2011 Overview 5
Plagiarism Policy Assignments must be entirely your own work n n n DON’T copy from others DON’T let anyone see your code we use plagiarism detection programs, which work very well w first detection: negative mark for assignment w second detection: failure of course w third detection: possible expulsion from Uni March 2005 2011 Overview 6
What TO DO in general keep up with lectures and tutorials n read textbook and lecture slides n attempt tutorial questions before the tutorial read Java programming guides and tutorials n books or online practice Java programming n laboratory consultations (mon 12 -1, thu 2 -3) n use tutorial exercises for practice n assignments alone are not enough March 2005 2011 Overview 7
What TO DO this week buy the textbook, and read chapter 1 register with sirius (in CSE labs) install Java 2 SDK on own PC (JDK 1. 4 or 1. 3) n may need to set PATH and CLASSPATH Java 2 online tutorial n n n Your first cup of Java Getting Started Learning the Java Language Week 2 tutorial questions March 2005 2011 Overview 8
For Help Tutorials/Assignments Java installation at home n n n JDK 1. 3 home computing CD from Comp. Soc, or online CSE helpdesk Java online docs Java programming n n labs consultations your tutor friends n n n Admin problems n email: cs 2011@cse. unsw. edu. au n n March 2005 Check FAQ on 2011 website 2011 consultants email alias then your tutor then the lecturer always use your CSE mail account, or include your student ID last resort, contact the lecturer -in-charge (Alan Blair) 2011 Overview 9
Example Program Copy. java (program for copying a file) $ ls Copy. java file 1 $ javac Copy. java $ java Copy file 1 file 2 $ ls Copy. class Copy. java file 1 file 2 $ diff file 1 file 2 $ March 2005 2011 Overview 10
copy. c #include
copy. c void copy( char *source, char *dest ) { FILE *file. In; FILE *file. Out; char one. Line[MAXLINE]; Copy. java source, String dest) { public static void copy(String Buffered. Reader file. In; Print. Writer file. Out; try { file. In = new Buffered. Reader( new File. Reader( source )); file. Out = new Print. Writer( new File. Writer( dest )); file. In = fopen( source, “r” ); if( File. In == NULL ) { printf( “Error: file not foundn” ); exit( 1 ); String one. Line; } while(one. Line = file. In. read. Line()) != null ) { file. Out = fopen( source, “w” ); file. Out. println( one. Line ); if( file. Out == NULL ) { } printf( “Error: file not foundn” ); file. In. close(); file. Out. close(); exit( 1 ); } } while( fgets(one. Line, MAXLINE, file. In ) catch( IOException e ) { System. out. println( “Error : ” + e ); != NULL ) { System. exit( 1 ); fputs( one. Line, file. Out ); } } } fclose( file. In ); fclose( file. Out ); March 2005 12 } 2011 Overview }
Next Time Why Java? Object Oriented Design Classes, Types, Objects Methods Expressions Control Flow Arrays Input / Output Packages March 2005 2011 Overview 13


