Chapter 1 Introduction to Java - NYU Computer Science Department

Introduction to Computers and Programming
Using Java -- Fall, 2006
Professor Deena Engel
V22.0002: Section 3
Email: deena@cs.nyu.edu
Office hours: Mondays 12:00-1:30 and Wednesdays 11:00 -12:30,
Room 526, WWH
 2003 Prentice Hall, Inc. All rights reserved. Customized by Deena Engel for the use of this class.
Course Objectives

Upon completing the course, you will understand
 Java programming





Primitive data types
Java control flow structure
Methods
Arrays
Java Applets
Course Objectives, cont.

You will be able to





Write, compile and run JAVA programs.
Create and use methods
Develop Java applets
Write interesting projects
Establish a firm foundation on Java concepts
Course Text Book

Introduction to JAVA Programming, Sixth Edition, by Liang,
Prentice Hall



Available at the NYU Bookstore
Lectures in PowerPoint format and programs which we write in
class will be posted to the class website.
Please keep up with the reading!
Book Chapters to be covered in this class:

Chapter 1 Introduction to Java

Chapter 2 Primitive Data Types and Operations

Chapter 3 Control Statements:

Selection Statements: If / else statements

Loop statements: for and while loops

Chapter 4 Methods

Chapter 5 Arrays

Chapter 14: Java Applets
Course Prerequisites

Prerequisites:


Who should be taking this course:




students who want to switch to a computer science major
students who want to take a computer science minor or a computer
applications minor
(http://cs.nyu.edu/web/Academic/Undergrad/minors.html)
students who are interested in programming
Who should NOT be taking this course



No prior programming experience required (Really!!)
Students trying to get out of taking a math requirement.
This class may be more difficult than the math you are trying to avoid.
You must get a C or better in this class to take further computer
science classes as a major.
Administrative Matters
Course Web Site

The course web site is available at:
http://www.cs.nyu.edu/courses/fall06/V22.0002003/Java_Home_fa06.htm

Our website contains the following information:








Administrative information
Course Syllabus
Homework assignments
Class notes
Class programs
Sample exams
Compiler instructions
Links to the class mailing list
Class mailing list

The class mailing list is available at
http://www.cs.nyu.edu/mailman/listinfo/v22_0002_003_fa06



Follow this link to subscribe!
All announcements will be sent to the class list
Homework questions may be sent to the list and answered
by students when possible.
Software


For the course, we will be using JCreator or NetBeans & SUN JDK software
to create, edit, compile and run our JAVA programs
These programs are free and you can download and use them for your home
computer.

To download software for home use, follow information posted on course
website




In order to use JCreator, you need to download both JDK (Java
Development Kit) and the JCreator IDE (Integrated Development
Environment).
Instructions are posted for NetBeans as well which runs on both PC and
Mac
All of these programs are free.
If you do not have your own computer, the computer labs on campus have these
compilers.
Grading

Your grade will be determined as follows:




First Midterm (20%)
Second Midterm (20%)
Homeworks (20%)
Final Exam (40%)
Homework
•Ten points will be deducted for each class day late with a possible maximum of
30 points being deducted.
•Homeworks will not be accepted after the third class following its due date
without special permission.
•For each assignment that you do not hand in within the time limit, your final
grade will be lowered by one letter grade ( i.e., if you are averaging a B+, but you
have missed 2 home works, your final grade will be B-).
•Submit the program via email to the grader (more on this later)
•Buy a few floppy disks or other storage media:
•For you own good you must save all programs on a disk and/or post them to
your home directory.
•Computer crashes or lost programs are not valid excuses for not handing in
an assignment!
A Word About Cheating


For the purposes of this class, cheating is defined as:
 Copying all or part of another student's homework, project or exam.
 Allowing another student to copy all or part of your homework,
project, or exam.
 Discussing homework concepts is fine, but you must submit your
own work
 Unless … If you work with a partner, you must both tell me and the
grader when the homework is submitted that you worked together
and also note that in both texts of the program comments.
If you are caught cheating, you will receive an immediate FAILURE for
the course.
Student Civility

In an effort to make this class enjoyable for
everybody…


Please be on time to class!
Please do not talk to your friends and neighbors in class!



It disturbs everyone, and makes it hard to concentrate.
If you have a question, just ask me!
Please turn your pagers and cell-phones off!
Getting Help: very important!!
Whenever you have a question about the course material …please feel free to drop by during my
office hours or write me an email message or call me on the phone.
If at any time you feel that you are falling behind or are overwhelmed by the material, please let me
know and I will be very happy to help you!


Help is always available!
Option1: Come to my Office Hours






Mondays 12:00-1:30 and Wednesdays, 11:00-12:30
Location: Room 526 Warren Weaver Hall
If you cannot make my office hours, I will be happy to make an
appointment with you at another time.
Option 2: Write to me at deena@cs.nyu.edu
Option3: See Lab tutor (10 hours a week). Hours are posted on the
course website under “Resources”.
Option4: Send email to e- tutor - information to be posted
Basic Computing information and history
What is a Computer?

Computer



Hardware



Device capable of performing computations and making logical
decisions
Computers process data under the control of sets of instructions
called computer programs
Various devices comprising a computer
Keyboard, screen, mouse, disks, memory, CD-ROM, and
processing units
Software

Programs that run on a computer
Hardware Trends

Every year or two the following approximately double:


Amount of memory in which to execute programs
Amount of secondary storage (such as disk storage)


Used to hold programs and data over the longer term
Processor speeds

The speeds at which computers execute their programs
Computer Organization

Six logical units in every computer:

Input unit


Output unit


Performs arithmetic calculations and logic decisions
Central processing unit (CPU)


Rapid access, low capacity, stores input information
Arithmetic and logic unit (ALU)


Outputs information (to screen, to printer, to control other devices)
Memory unit


Obtains information from input devices (keyboard, mouse)
Supervises and coordinates the other sections of the computer
Secondary storage unit


Cheap, long-term, high-capacity storage
Stores inactive programs
Evolution of Operating Systems

Single_user Batch processing


Do only one job or task at a time
Early Operating systems


Manage transitions between jobs (minimizing transition time
between jobs)
Increased throughput


Multiprogramming


Amount of work computers process
Computer resources are shared by many jobs or tasks (users still
waited a long time for their output)
Timesharing (access computers via terminals)

Computer runs a small portion of one user’s job then moves on to
service the next user
Personal Computers

Personal computers




Distributed computing


Economical enough for individual
Popularized by Steve Jobs and Steve Wozniak with the introduction of
the Apple in 1977.
In 1981 IBM introduced the IBM personal computer using “off the shelf”
components.
Computing distributed over networks
Client/server computing

Sharing of information across computer networks between file servers
and clients (personal computers)
Programming languages
Three types of programming languages
 Machine languages


Strings of numbers giving machine specific instructions
Example:
+1300042774
+1400593419
+1200274027

Assembly languages

English-like abbreviations representing elementary computer operations (translated
via assemblers)


Example:
LOAD
ADD
STORE
BASEPAY
OVERPAY
GROSSPAY
High-level languages



Codes similar to everyday English
Use mathematical notations (translated via compilers)
Example:
grossPay = basePay + overTimePay
Other High-level Languages

high-level languages

FORTRAN


COBOL


Used to manipulate large amounts of data
Pascal


Used for scientific and engineering applications
Intended for academic use
Ada

Used in Defense Department Applications
Structured Programming

Structured programming



Disciplined approach to writing programs
Clear, easy to test and debug and easy to modify
Structured programming is hard and takes time to master
The Key Software Trend:
Object Technology

Objects


Reusable software components that model items in the real world
Meaningful software units



Date objects, time objects, paycheck objects, invoice objects, audio
objects, video objects, file objects, record objects, etc.
Any noun can be represented as an object
More understandable, better organized, and easier to maintain than
procedural programming
Good luck! I look forward to working with you!!
Please speak to me if you have questions or comments
Deena Engel (mail to: deena@cs.nyu.edu or call at 998-3131)