Presentation is loading. Please wait.

Presentation is loading. Please wait.

415.111 SC Introduction to Programming Lecture 1: 5 th May 2003.

Similar presentations


Presentation on theme: "415.111 SC Introduction to Programming Lecture 1: 5 th May 2003."— Presentation transcript:

1 415.111 SC Introduction to Programming Lecture 1: 5 th May 2003

2 Lecturer: Dr Jennifer Lennon –Room 565 –email: jennifer@cs.auckland.ac.nz –Office hours: Mon (2-3), Wed (2-3), Course Information

3 Labs 15% Test 20% Final Exam 65% Lectures Final exam HomeworkFinal exam Labwork Final exam Course composition

4 . Text –The Explorer’s Guide to Programming (to be collected (FREE OF CHARGE) from the Resource Centre) Lecture notes (for revision) Labs – as usual Course Information contd

5 What is programming? What is Java? How do we run a Java program? What is a program? Introduction to Applets: –The coordinate system –Drawing text in the Applet window This lecture: Outline

6 Getting the computer to follow our instructions E.g. Alice as well as all the Microsoft Office applications are programs What is programming?

7 To better understand how computers work To make more intelligent guesses when they don’t work In industry: –80% work can be done by applications –20% must be done by programmers Why Learn programming?

8 Java Why??? –It is a good teaching language –This is the Computer Science dept. –Follows through to COMPSCI.101 –It is a language for professionals Is programming an art or a science? Both What language will we use?

9 Attend all lectures Read every word of the Explorer’s Guide Do every exercise in the Explorer’s Guide Attend all tutorials Complete every assignment You only learn by writing programs yourself For Success in Learning Java

10 What is a program? It is a series of statements. For example the statement: g.drawString( " Hello Computer ", 50, 100); Displays Hello Computer on the computer screen. What happens if we make a mistake? The computer displays an error message, or it does something unexpected.

11  Open the 111 Course folder  Open the Explorer’s Guide folder  Open the Sample programs folder  Copy the Chapter 1-progs to your G:drive.  Open the program of you want to run Running a program

12 Running a program continued: Double click on the FirstHello.java file

13 Running a program contd  Now choose Run Java Applet from the Tools menu After a short wait the following window appears:

14 The Program p9

15 –The following line tells the Java system that we are going to draw in the Applet window: –public void paint( Graphics g ) –In Java terminology we say that we are going to "paint" in the window. Painting in the Applet Window

16 The Applet Window: a grid Pixels :

17 g.drawString( "Hello World!", 30, 30 ); –This tells the system that we are going to draw the string "Hello World!" at position (30, 30) in the Applet window. The g.drawString() Statement

18 Co-ordinates p10

19 Positioning the text p12 (30,30) g.drawString("Zing!", 30, 30 );

20 g.setFont() Changing the font and font size p12 // * * * * * * * * * * * * * * * * * * * * * * * // Hello Computer program revisited g.setFont( new Font ( "TimesRoman", Font.BOLD, 18 )); g.drawString( "Hello Computer!", 30, 30 ); // * * * * * * * * * * * * * * * * * * * * * * *


Download ppt "415.111 SC Introduction to Programming Lecture 1: 5 th May 2003."

Similar presentations


Ads by Google