Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.

Slides:



Advertisements
Similar presentations
Chapter 1 An Overview of Computers and Programming Languages.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
Visual and Internet Programming using JAVA
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
Three types of computer languages
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Chapter 1 Introduction to C Programming. 1.1 INTRODUCTION This book is about problem solving with the use of computers and the C programming language.
 2002 Prentice Hall. All rights reserved. Week 1 - Introduction to Object- Oriented Programming Outline 1.1 Machine Languages, Assembly Languages and.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Java PAL.  Contains the development kit and the runtime environment ( aka the Java Virtual Machine )  Download Link:
Computer Software.
COMP Computer Basics Yi Hong May 13, 2015.
SOFTWARE.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction 1.2 What Is a.
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
1 Chapter 1 - Introduction to Computers, the Internet, and the World Wide Web Outline 1.1Introduction 1.2What Is a Computer? 1.3Computer Organization 1.4Evolution.
Introduction COMP104: Fundamentals and Methodology.
Chapter 1 An Overview of Computers and Programming Languages.
“C” Programming Language What is language ? Language is medium of communication. If two persons want to communicate with each other, they have to use.
 2005 Pearson Education, Inc. All rights reserved. 1 Introduction & The Java Virtual Machine Small Java Chapter 1 1.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
COMPUTER SOFTWARE Section 2 “System Software: Computer System Management ” CHAPTER 4 Lecture-6/ T. Nouf Almujally 1.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
 2003 Prentice Hall, Inc. All rights reserved. 1 Java Training Course Dr. H.E. Dunsmore Purdue University Java – How to Program, Deitel (5 th Edition)
 2005 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and the World Wide Web.
Introduction to Interactive Media Interactive Media Tools: Software.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
 2006 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
1 MIS 131 Introduction to Algorithms and Programming 2015/2016 Fall - Chapter 1 -
1 Programming Fundamentals How to Program in C++ How to Program in C++
CT1513 Introduction To java © A.AlOsaimi.
Spring 09- ICE0124 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 1.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Application Software System Software.
1 Introduction Read D&D Sec 1.8; Sec 1.13 THE Java tutorial -
CHAPTER 1.1 INTRODUCTION TO COMPUTERS AND C++ Dr. Shady Yehia Elmashad.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Chapter 1 An Overview of Computers and Programming Languages.
1 Chapter 1 Java –Originally for intelligent consumer-electronic devices –Then used for creating Web pages with dynamic content –Now also used for: Develop.
Introduction to Programming 1 1 2Introduction to Java.
1 Chapter 1 Background Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Computer Software.
Introduction to Computers, the Internet and the World Wide Web
Chapter 1 – Introduction to Computers, the Internet, and the Web
Outline Introduction What Is a Computer? Computer Organization
Lecture 1: Introduction to JAVA
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Java programming lecture one
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Computer Science I CSC 135.
Introduction CSC 111.
Introduction to Computer Software
Outline Introduction What Is a Computer? Computer Organization
Computer Programming-1 CSC 111
Function of Operating Systems
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle

2 Computer Programs Computers perform many different kinds of tasks. Computers perform many different kinds of tasks. In order to perform these tasks, they need to be provided with instructions. In order to perform these tasks, they need to be provided with instructions. These sets of instructions are called computer programs. These sets of instructions are called computer programs. Computer programs are written by people called computer programmers. Computer programs are written by people called computer programmers.

3 Types of Computer Programs There are two main types of computer programs (also called “software”): There are two main types of computer programs (also called “software”): System software System software Application software Application software

4 Types of Computer Programs System software System software Used by the computer to perform tasks Used by the computer to perform tasks Consists of two main types of programs: Consists of two main types of programs: Operating system Operating system Controls the way the computer works from the time it starts up until the time it shuts down Controls the way the computer works from the time it starts up until the time it shuts down Different operating systems include: Different operating systems include: Microsoft Windows Microsoft Windows Mac OS Mac OS UNIX UNIX Linux (UNIX-like OS) Linux (UNIX-like OS) Utility programs Utility programs Small programs that handle system management and maintenance Small programs that handle system management and maintenance Example: Disk defragmenter Example: Disk defragmenter

5 Types of Computer Programs Application software Application software Used by people to perform tasks Used by people to perform tasks General categories of application software include: General categories of application software include: Software development (e.g., jGRASP, MS Visual Studio) Software development (e.g., jGRASP, MS Visual Studio) Productivity (e.g., MS Word) Productivity (e.g., MS Word) Financial (e.g., Peachtree Accounting) Financial (e.g., Peachtree Accounting) Multimedia (e.g., Adobe Photoshop) Multimedia (e.g., Adobe Photoshop) Educational (e.g., MS Encarta) Educational (e.g., MS Encarta) Communication (e.g., Lotus Notes) Communication (e.g., Lotus Notes) Entertainment (e.g., computer games) Entertainment (e.g., computer games)

6 Computer Programming Languages Computer programmers write programs in a variety of programming languages. Computer programmers write programs in a variety of programming languages. These languages may be divided into three general types. In order of evolution, they are: These languages may be divided into three general types. In order of evolution, they are: Machine language Machine language Assembly language Assembly language High-level language High-level language

7 Computer Programming Languages Machine language Machine language The “natural language” of a particular computer The “natural language” of a particular computer Machine-dependent, i.e., defined by the hardware of a particular machine Machine-dependent, i.e., defined by the hardware of a particular machine Consists of strings of numbers ultimately reducible to 1s and 0s Consists of strings of numbers ultimately reducible to 1s and 0s Example: Example:

8 Computer Programming Languages Assembly language Assembly language A language that uses English-like abbreviations (symbols, or mnemonics) to represent the elementary operations of the computer A language that uses English-like abbreviations (symbols, or mnemonics) to represent the elementary operations of the computer Symbolic code is translated into machine code using a program called an assembler, hence the name “assembly language” Symbolic code is translated into machine code using a program called an assembler, hence the name “assembly language” Example: add $t0, $s1, $s2 Example: add $t0, $s1, $s2

9 Computer Programming Languages High-level language High-level language A language that uses English-like statements to accomplish multiple operations A language that uses English-like statements to accomplish multiple operations Portable, i.e., NOT machine-dependent Portable, i.e., NOT machine-dependent High-level language programs are translated into machine (or byte) code using programs called compilers High-level language programs are translated into machine (or byte) code using programs called compilers FORTRAN was the first high-level language FORTRAN was the first high-level language C, C++, Java, and Microsoft’s.NET languages (e.g., Visual Basic, C#) are currently among the most widely used high-level languages C, C++, Java, and Microsoft’s.NET languages (e.g., Visual Basic, C#) are currently among the most widely used high-level languages Example: t0 = s1 + s2 Example: t0 = s1 + s2

10 Brief History of the Java Programming Language Java was developed at Sun Microsystems in the early 1990’s as the result of a funded research project to develop intelligent consumer electronic devices. Java was developed at Sun Microsystems in the early 1990’s as the result of a funded research project to develop intelligent consumer electronic devices. It was created by James Gosling, who originally called it … ? (Your turn!) It was created by James Gosling, who originally called it … ? (Your turn!) Java is based on C++, a high-level language that evolved from the C language. Java is based on C++, a high-level language that evolved from the C language. Like C++, it provides support for object-oriented programming, a programming style in which reusable software components called “objects” are used to model items in the real world. Like C++, it provides support for object-oriented programming, a programming style in which reusable software components called “objects” are used to model items in the real world.

11 Brief History of the Java Programming Language Java is touted for its “portability,” which means that it is easier to write programs in Java that run on many different computers than it is to do so in other programming languages. Java is touted for its “portability,” which means that it is easier to write programs in Java that run on many different computers than it is to do so in other programming languages. Java is widely used to implement Internet- based applications and software for devices that communicate over a network (e.g., cell phones and PDAs). Java is widely used to implement Internet- based applications and software for devices that communicate over a network (e.g., cell phones and PDAs).

12 Developing a Java Program There are 5 phases in the development of a Java program: There are 5 phases in the development of a Java program: Edit Edit Compile Compile Load Load Verify Verify Execute Execute

13 Developing a Java Program 5 phases in the development of a Java program: 5 phases in the development of a Java program: Edit Edit The programmer uses an editor to create a source code file and saves it to disk. The programmer uses an editor to create a source code file and saves it to disk. Example: Using the text editor that comes with jGRASP to create Time.java Example: Using the text editor that comes with jGRASP to create Time.java Compile Compile The compiler translates the Java source code into bytecodes and saves the file to disk. The compiler translates the Java source code into bytecodes and saves the file to disk. Bytecodes are the “language” that the Java Virtual Machine (JVM) understands. (A virtual machine is a software application that simulates a real machine, i.e., computer.) Bytecodes are the “language” that the Java Virtual Machine (JVM) understands. (A virtual machine is a software application that simulates a real machine, i.e., computer.) Example: Time.class Example: Time.class Load Load The loader loads the.class file containing the bytecodes into the computer's memory. The loader loads the.class file containing the bytecodes into the computer's memory. Example: None. Example: None.

14 Developing a Java Program 5 phases in the development of a Java program: 5 phases in the development of a Java program: Verify Verify The bytecode verifier examines a.class file as it is being loaded to ensure that its bytecodes are valid and do not violate Java’s security restrictions. The bytecode verifier examines a.class file as it is being loaded to ensure that its bytecodes are valid and do not violate Java’s security restrictions. Example: None. Example: None. Execute Execute The JVM executes the program by reading the bytecodes and translating them into a language the computer can understand (i.e., machine language). The JVM executes the program by reading the bytecodes and translating them into a language the computer can understand (i.e., machine language). Example: None. Example: None.

15 Developing an Algorithm What is an "algorithm"? What is an "algorithm"? An algorithm is a series of actions (statements) executed in a specific order to solve a programming problem. An algorithm is a series of actions (statements) executed in a specific order to solve a programming problem. Let's develop an algorithm for a “time" program. Let's develop an algorithm for a “time" program. The problem: Write a Java program that prompts a user to enter a distance and a speed, then computes and prints the time it takes to travel that distance. The problem: Write a Java program that prompts a user to enter a distance and a speed, then computes and prints the time it takes to travel that distance.

16 Developing an Algorithm Let's develop an algorithm for a “time" program. Let's develop an algorithm for a “time" program. The algorithm: The algorithm: Set aside storage space for the input (distance, speed) and output (time) values. Set aside storage space for the input (distance, speed) and output (time) values. Prompt the user for the distance and the speed. Prompt the user for the distance and the speed. Read and store each of the values input by the user. Read and store each of the values input by the user. Calculate the time required to travel the given distance at the given speed. Calculate the time required to travel the given distance at the given speed. Display the time. Display the time.

17 Lab 1 Preview Before trying to solve the “time” problem, let’s first look at a simpler problem, the first programming problem in Lab 1: Fall2007/LabProjects/csc1401lab01.html Before trying to solve the “time” problem, let’s first look at a simpler problem, the first programming problem in Lab 1: Fall2007/LabProjects/csc1401lab01.html Fall2007/LabProjects/csc1401lab01.html Fall2007/LabProjects/csc1401lab01.html