SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a...

22
SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine . . .”

Transcript of SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a...

Page 1: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 1

Welcome to ENGR 2304/COSC 1336 Engineering Programming

Want to be a “Lean, mean programming machine . . .”

Page 2: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 1

Welcome to ENGR 2304/COSC 1336 Engineering Programming

• My name is Dick Whipple

• BSEE, MSEE from UH

• Designed and programmed computers for 25 years

• The course, ENGR 2304/COSC 1336 . . .

• Is designed as a first programming course.

• Is widely accepted for transfer.

• Will use Java as the programming language.

• Will focus on engineering problem solving.

• Is WebCT enhanced with lab on Internet.

Page 3: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 1

Very Important Information

Objectives for Thursday• Access course on my website

http://tech.swtjc.net/whipple_online/• Logon to WebCT & this class

http://70.241.209.12/webct/public/home.pl• Add both links to your favorites!• Review the syllabus• Start Assignment 1• Read Chapter 1-1 of the text, Java Software

Solutions by Lewis and Loftus• Install JBuilder from CD-ROM

Page 4: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 1

Class Attendance

• Attend class regularly

• Class begins promptly At 8:00 AM

• Class WebCT enhanced including . . .

• Access to study materials

• Lecture PowerPoints

• Videos

• Other readings

• Complete/submit lab assignments

Page 5: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 2

Demonstrate Responsibility

• Read and follow instructions to the letter.

• Read and study all assigned “Text Readings”.

• Research the Internet as directed.

• Utilize WebCT as an enhancement to the course.

• Ask questions when you don’t understand.

• Complete work on time and without weak excuses.

• Take your first steps as a “Professional”!

Page 6: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 3

Computers Are Not Magic

"There is nothing magic about computers.  Any answer that a computer can arrive at could also be arrived at by a human if he/she lived long enough, had enough pencils, etc.  What's important to remember is that, regardless of the speed at which a computation is done, the process is a straightforward, one step at a time, matter."

"That isn't to say that a person or persons can solve any problem a computer can.  Sometimes temporal (time) problems are a part of the problem.  The numbers which tell the rockets of a space ship what to do after the first stage lets go can't take six months for a human to compute with paper and pencil.  If more than a second or so is required, a satellite may be falling down someone's chimney."

Michael Kennedy and Martin B. Solomon

Page 7: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 3

Communicating with Computers

"A person who wants to use a computer must learn to be precise.  One does not communicate with a computer by hand waving and mumbling.  A computer can be of service only if it is instructed carefully and according to preset rules."

Michael Kennedy and Martin B. Solomon

As a student in ENGR 2304, I expect you to follow this admonition to the letter.

If you are not willing to do so, this class may not be for you!

Page 8: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 3

Purpose of a Programming Language

• The purpose of a programming language is to facilitate communication between humans and computers.

• Computers are very accurate and fast at following instructions, but understand only “bits and bytes”.

• Humans know what instructions to give, but cannot easily give them to computers in “bits and bytes”.

• Computer languages bridge the gap!

Page 9: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 3

Examples of Programming Languages

• Java, Visual Basic, & C++ are multipurpose languages.

• Fortran & Aida are scientific languages.

• Cobol is a business language.

• Assembly languages create fast, compact code for 3D animation and gaming.

• Markup languages like HTML are Internet based.

• Scripting languages like JavaScript perform utility duty.

Page 10: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 4

History of Java

• Developed at Sun Microsystems in early 1990’s.

• Development team led by James Gosling.

• Originally called Oak and used in embedded consumer electronic applications.

• In 1995 renamed Java and redesigned for Internet applications.

• Gained renown as a general purpose programming language.

Page 11: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 5

Characteristics of Java

• Simple, modeled after C++ but easier to use

• Object oriented, not procedural.

• Distributed, adaptable to networking environments

• Interpreted, runs on almost all computers

• Robust & reliable; emphasizes error checking & good habits

• Secure, will not damage a computer

• Architecture neutral, platform independent

• Portable, runs without being recompiled

• Performance good though not the fastest

• Multithreaded, performs several tasks at once

• Dynamic, adapts to evolving environment

Page 12: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 6

Java’s Relationship with World Wide Web

• HTML is the authoring language for WWW.

• Java programs run from browser.

• Java makes the web environment “smarter”.

• Java adds responsiveness and interactivity.

• Java uses modern GUI interface.

• Java enhances web graphics.

• Java allows the web page to respond to user events.

Page 13: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 7

Java Development Environments

• Sun Microsystems provides JDK (Java Toolkit)

• JDK is basic and simple, but inefficient as design tool.

• Other environments are better

• NetBeans from Sun

• JBuilder from Borland (we will use this!)

• Visual Café from Webgain

• Visual Age from IBM

• Visual J++ from Microsoft

Page 14: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 7

IDE NetBeans

• Easy to learn

• Simple to use

• Adaptable to user requirements

• Readily navigated to access . . .

• packages

• projects

• programs

• classes

• code elements

NetBeans provides an IDE (Integrated Development Environment)that is . . .

Page 15: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 8

Installing NetBeans

• Download NetBeans from:http://java.sun.com/javase/downloads/netbeans.html

• Run the “.exe” file

• You’ll be ready to “Run” your first program in not time!.

Page 16: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 9

Elements of AppBrowser Window

Page 17: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

Types of Java Programs

• Application - A stand alone program written with a high level language such as Java.

• Executed from the computer by a Java interpreter

• Not subject to security restrictions

• Must contain a “main” method

• Applet - Special kind of Java program that runs from a web browser or applet viewer.

• Subject to security restrictions

• Cannot make changes to user’s system

• Cannot read or write files

• Cannot transmit computer viruses

Page 18: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

Java Program Components

Java’s programming components:

Packages - Collection of classes (Programs)

Classes - Collections of data and methods that operate on data

Methods - Collections of statements that operate on data

Variables - Stores dataConstants - Stores data that doesn’t changeLiterals - Explicitly given dataData{

Page 19: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

Java Programming Process

1. Create source code.

Programmer creates source.

Stores in filename.java .

2. Compile source.

Converts source code to bytecode.

Stores in filename.class. (Ready to execute.)

3. Execute bytecode in filename.class.

Page 20: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

Steps to Create a Program

1. Create a Java project.

2. Create a Java application program.

1) Create a new class.

2) Create the main method.

3. Compile and execute – “Run” the application.

Page 21: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

First Program with JBuilder

/*My First Program

*/public class HelloWorld { public static void main(String[] args) { // Declare variables // Input data // Process data // Output Results System.out.println("Hello World"); }}

Page 22: SWTJC STEM Chapter 1-1 cg 1 Welcome to ENGR 2304/COSC 1336 Engineering Programming Want to be a “Lean, mean programming machine...”

SWTJC STEM

Chapter 1-1 cg 10-14

What to do now?

• Click on “Online Classes” at SWTJC’s homepage.

• Click on “Class Schedule and find this class.

• Link to my homepage and click on ENGR 2304.

• Follow the instructions there for New Students.

• Complete Assignment 1 by Thursday, February 4, 2010.