Download presentation
Presentation is loading. Please wait.
1
Copywrite 2003 Walter Savitch These slides are for the exclusive use of students in CSE 11 at UCSD, Winter quarter 2003. They may not be copied or used for any other purpose without the written permission of Walter Savitch.
2
CSE 11 Walter Savitch 3620 APM
3
CSE 11 = CSE 8A + CSE 8B You do not need to know any Java to take this course, BUT If you have not programmed before in some language, you should not take this course. You do Chapters 1-3 of Savitch text on your own. It should be close to a “a review.”
4
Text Book Savitch, “Java: An Introduction to Computer Science and Programming,” Second Edition. Some UNIX book of your choice. (A suggestion is on the handout.)
5
Get Handout and READ IT! You must have a computer account for this course. (It starts cs11w__) All Home Work graded in interviews. All interview in SUNPAL lab APM 3414. Teams; HW 1 work alone. All other HW can work in teams of 2.
6
Home Work Deadlines Two deadlines: turnin deadline, interview deadline. If you miss the turnin deadline, you get zero for the assignment. If you miss the interview deadline by one or two days, you pay a penalty. If you miss the interview deadline by more than two days, you get zero.
7
No Work Accepted Late for Any Reason Except as already noted for interviews. Read the handout.
8
Home Work 1 Is on the handout. If you do not pass HW 1 by the deadlines, you must drop the course. No exceptions. If you take an interview before the turnin deadline, you do not need to turn in the assignment. Instructions for turning in assignments will be given in a later lecture.
9
Home Work 1 Deadlines Correction Turnin deadline Friday January 17. Interview deadline Tuesday January 21. There is a mistake in the deadlines on the handout. Home work 2 deadlines will be immediately after HW 1 deadline. The HW2 turnin deadline may be BEFORE the HW1 interview deadline.
10
Proctor Hours In public directory On website APPROXIMATELY: M-Th 9AM-10PM F 10Am-6PM Sa noon-6pm
11
Quizzes Surprise quizzes at end of some lectures. Do not ask “Will there be a quiz today?” Cannot makeup a missed quiz for any reason.
12
Read the Handout Cheating policy. Meaning of turnin deadlines. Grading policy. No late work policy.
13
Home Computer You do not need a home computer. If you work on a home computer, you must somehow move your files to the SUNPAL lab for turnin and interviews. Java for your home computer is free on Sun website. See Savitch book preface. Get version 1.4 or higher. (1.2 is good enough.)
14
UNIX We will use the UNIX operating system in the SUNPAL laboratory for all interviews. Your programs must be on the SUNPAL machine and must compile and run there. You need to know enough UNIX to manipulate files, edit files, compile and run your programs. No UNIX on any quiz or exam. Only test of UNIX is that you can do the interviews in the SUNPAL lab.
15
Editor You can use any editor you wish in the SUNPAL lab, so long as the proctor can give you an interview.
16
UNIX commands Learn command line commands. More details in discussion section.
17
UNIX Commands cp file1 file2 cp file1 directory mv file1 file2 rm file
18
Wildcards cp * directory cp *.java directory
19
Directories Often called folders mkdir directoryName cd subdirectoryName cd.. cd ~ Learn about absolute and relative path names.
20
Java General purpose programming language. Includes GUI (Graphical User Interface) libraries. Includes lots of other libraries. Has Internet stuff, but we will use little of it directly.
21
Java, What’s Unique? Byte Code Compile a Java program, such as MyProg.java, to byte code, MyProg.class. Interpret byte code using Java Virtual Machine. All but the Java Virtual Machine is portable. Same Java program and same byte code runs on any computer.
22
Java, What’s Unique? Lots of libraries. Threads: multiple processes (not covered in this class.) Applets (Covered but no big deal)
23
Object Oriented Programming OOP The accepted way to program now. To you, “programming” and “object oriented programming” mean the same thing. Explained in detail after you know more, but more or less everything you are learning is OOP. Java is an OOP language. So is C++. C is not. If the language has classes it is an OOP language.
24
Chapters 1-3 Expressions, similar to most all other languages. int n = 5*(count + 7); //Assignment Flow of control. Same as C++; similar to other languages.
25
Java Types Primitive types: int, double, boolean, char, others. Class types, String and others including all the things that you define in Java.
26
boolean Is a full fledged type in Java. Values are not and do not convert to integers. Values are true and false. true is not 1, false is not 0.
27
Spelling Conventions Class names start with an uppercase, for example, String. Variable (and most other things) start with a lowercase, for example, theTime, rate, myStuff, yourStuff. Constants (literals) all uppercse, for example, NUMBER_OF_PEOPLE
28
Spelling Conventions Do not abbreviate use myFirstScore not myFrSc use timeLimit not tmLim nor tmLimit
29
Console Output int number = 7; System.out.println(number + “ things”); Screen output: 7 things
30
Console Input System.out.println(“Enter an integer:”); int number = SavitchIn.readLineInt(); Sets the value of number to the integer types in at the keyboard. The integer must be on a line by iteslf.
31
SavitchIn.readLineInt() SavitchIn is a class. readLineInt is a method. () indicates no arguments. Returns a value of type int, namely the integer entered at keyboard. Good error messages if user screws up.
32
SavitchIn A class written in Java. Is not a standard Java library class. The file SavitchIn.java (or SavitchIn.class) must be in the same directory as your program. File SavitchIn.java is with programs on machine in SUNPAL and is on CD in the Savitch text.
33
SavitchIn readLineInt() readLineDouble() readLineNonWhiteChar() readLine()
34
readLineNonWhiteChar() Different from other methods Reads the first nonwhite char on a line and discards the rest of the line. The char need not be the only thing on the line. If line is yes it reads the ‘y’
35
Next time start Chapter 4 Get a course account before you leave today.
36
public class FirstProgram { public static void main(String[] args) { System.out.println("Hello out there."); char answerLetter; answerLetter = SavitchIn.readLineNonwhiteChar(); if (answerLetter == 'y') System.out.println("Nice weather."); System.out.println("Good-bye."); }
37
public class NameOfProgram { public static void main(String[] args) { Your Code Goes Here. }
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.