CSC1200 INTRODUCTION TO PROGRAMMING

Download Report

Transcript CSC1200 INTRODUCTION TO PROGRAMMING

CSC1200
INTRODUCTION TO
PROGRAMMING
Dr. Maureen Markel
http:faculty.msmc.edu
Chapter 1:
Introduction
Object-Oriented Program
Development Using Java:
A Class-Centered
Approach
Objectives of Chapter 1
• Computer Science and Programming
Languages
• Objects and Classes
• Constructing a Java Program
• The PrintStream Class’s print() and println()
Methods
• Using the javax.swing Package
• Programming Style
• Common Programming Errors
Computer Science and
Programming Languages
• Information age
– Almost totally dependent and driven by
information technology
• Computer science
– Science of computers and computing
• Computer scientists
– Solve problems using the scientific method
Fundamental Areas of
Computer Science
This text will focus on:
• An introduction to computer architecture
• The Java programming language
• Class development and design
• Algorithm development
Programming Languages
• Computer program
– Also called software
– A self-contained set of instructions and data used to
operate a computer to produce specific results
• Programming
– process of developing and writing a program
• A programming language
– is a set of instructions that can be used to construct a program
Programming Languages
(continued)
• Low-level languages:
– Machine language
– Assembly language
Programming Languages
(continued)
• High-level languages:
– Use instructions that resemble natural languages
– Can be run on a variety of computer types
– Examples:
• Pascal
• Visual Basic
•C
• C++
• Java
Programming Languages
(continued)
• Source program
– Programs written in a computer language
• Interpreted language
– Each statement is translated individually
and executed immediately upon translation
• Compiled language
– All statements are translated as a complete
unit before any one statement is executed
Programming Languages
(continued)
• Java is both:
– Compiled
– Interpreted
• Java Virtual Machine
– Software program that can read bytecode
produced by the compiler and execute it
Procedure and Object
Orientations
• Procedure-oriented language
– Available instructions are used to create selfcontained units
• Object-oriented language
– Program must first define objects it will be
manipulating
• Java is object-oriented
The Development of Java
• History:
– Fortran
– COBOL
– BASIC
– Pascal
– C++
– Java
The Development of Java
(continued)
• Web browser
– A program located and run on a user’s
computer to display Web pages
– Java can run from a Web browser
• Java provides:
– Cross-platform compatibility
– Write-once-run-anywhere capability
Objects and Classes
• Objects
– Part of the Java programming language as
component types
– Can be custom tailored by programmers
– Programmers can define custom objects
A Class Is a Plan
• The structure for a class of objects must
be created at the start of the programming
process
• Class
– Explicitly written plan
– Complete set of parts and instructions needed
to create items
From Recipe to Class
• Data declaration section
– Description of data to be used
• Methods section
– Defines how to combine data components to
produce desired result
Task: Explain the following terms
•
•
•
•
•
•
•
•
•
High level language
Source Code
Interpreted language
Compiled language
Characteristics of three different programming
languages excluding Java
Host computer
Procedural language
Object-oriented language
Advantages of Java