Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
 Computer hardware components are the physical pieces of the computer.  The major hardware components of a computer are: – The central processing.
CSCE 145: Algorithmic Design I Chapter 1 Intro to Computers and Java Muhammad Nazmus Sakib.
1 Fall 2009ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: Early Objects Third Edition by Tony Gaddis Chapter.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Fall 2008ACS-1903 Chapter 1 Topics Java History Java Programs Why Program? Computer Systems: Hardware and Software Programming Languages What Is a Program.
1 Fall 2007ACS Fall 2007 Text: Starting out with java from control structures through data structures Gaddis & Muganda Instructor: Ron McFadyen.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
Lecture 2: Do you speak Java?. From Problem to Program Last Lecture we looked at modeling with objects! Steps to solving a business problem –Investigate.
Chapter 1: Introduction to Computers and Java
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
LESSON 1 INTRODUCTION Compiled By: Edwin O. Okech [Tutor, Amoud University] JAVA PROGRAMMING.
CS102 Introduction to Computer Programming
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1 Coding Introduction.
Parts of a Computer Why Use Binary Numbers? Source Code - Assembly - Machine Code.
© 2012 Pearson Education, Inc. All rights reserved. Starting Out with Java: From Control Structures through Data Structures Second Edition by Tony Gaddis.
Introduction to Java Lecture # Java History Green Team started by Sun Microsystems. *7 Handheld controller for multiple entertainment systems.
 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.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
High-level Languages.
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.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1 Introduction to Computer and Java 1. Contents 1.Introduction 2.Why Program? 3.Computer Systems: Hardware and Software 4.Programming Languages.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
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.
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
Chapter 1: Introduction to Computers and Java
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
CHAPTER 1 Introduction to Computers and Java Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 1- 1 October 20, October 20, 2015October 20, 2015October 20,
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: From Control Structures through Objects Third Edition.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
©2016 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. CSC 110 – INTRO TO COMPUTING - PROGRAMMING Overview of Programming.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Chapter 1: Introduction to Computers and Java 1-2 Chapter Topics Chapter 1 discusses the following main topics: –Introduction –Why Program? –Computer.
Software. Introduction n A computer can’t do anything without a program of instructions. n A program is a set of instructions a computer carries out.
CHAPTER 1 Introduction to Computers and Java Copyright © 2016 Pearson Education, Ltd.
© 2012 Pearson Education, Inc. All rights reserved. Starting Out with Java: From Control Structures through Data Structures Second Edition by Tony Gaddis.
BlueJ X ICSE Syllabus. Board Pattern THEORY (100 marks) PRACTICAL (100 marks) PROJECT (50 marks) ASSIGNMENTS (50 marks)
Software Engineering Algorithms, Compilers, & Lifecycle.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Introduction to Algorithm. What is Algorithm? an algorithm is any well-defined computational procedure that takes some value, or set of values, as input.
Chapter 1 Coding Introduction.
Basic Concepts: computer, program, programming …
Java Programming: From the Ground Up
Lecture 1b- Introduction
CSCI-235 Micro-Computer Applications
Key Ideas from day 1 slides
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: Introduction to Computers and Java
Introduction CSC 111.
Programming Logic and Design Eighth Edition
Presentation transcript:

Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions form an algorithm

Why Program? Computers are tools that can be programmed to perform many functions. Computers are versatile because they can be programmed. Implement ______________________ to solve problems or calculate answers to problems, listen to music …

Why Program? Computers are tools that can be programmed to perform many functions. Computers are versatile because they can be programmed. Implement algorithms to solve problems or calculate answers to problems, listen to music …

What to Program? Aspects of a computer program that must be designed: The logical flow of the instructions The mathematical procedures The layout of the programming statements The appearance of the screens The way information is presented to the user The program’s “user friendliness”

How to Program? Programs must be analytically correct. Programs rarely work the first time they are programmed. Programmers must perform the following on a continual basis: analyze, experiment, correct, and redesign. Programming languages have strict rules, known as syntax, that must be carefully followed.

Programming Languages In order to understand a program, the computer needs the program to be written in machine language. Machine language is written using binary numbers. The binary numbering system (base 2) only has two digits (0 and 1). Example machine language computer code: 0010101010101010111001010101010101 0101010101010111101010000101010110 Problem? Machine language for a Mac CPU is not the same as the machine language as an Intel CPU. Different processors have different machine languages

Programming Languages In the distant past, programmers wrote programs in machine language. Programmers developed higher level programming languages to make things easier. Some common programming languages: BASIC COBOL Pascal C C++ Java

Morgan Kaufmann Publishers April 23, 2017 A Bit On Java First Developed by Sun Microsystems in 1991 There was a need for a programming language that would run on various devices. Ideal for internet browsers Java incorporated into Netscape in 1995 Java is “cross platform”, meaning that it can run on various computer operating systems. Chapter 1 — Computer Abstractions and Technology

How does Java work? A programmer writes Java programming statements for a program. These statements are known as source code. A text editor is used to edit and save a Java source code file. (We will use Jcreator) Source code files have a .java file extension. A ___________ is a program that translates source code into an executable form.

How does Java work? A programmer writes Java programming statements for a program. These statements are known as source code. A text editor is used to edit and save a Java source code file. (We will use Jcreator) Source code files have a .java file extension. A compiler is a program that translates source code into an executable form.

The Compiler and the Java Virtual Machine A compiler is run using a source code file as input. Syntax errors are mistakes that the programmer has made that violate the rules of the programming language. Discovered at “compile time” The compiler creates another file that holds the translated instructions.

The Compiler and the Java Virtual Machine The Java compiler translates a Java source file into a file that contains byte code instructions. Files end with at .class extension Byte code instructions are the machine language of the Java Virtual Machine (JVM) and cannot be directly executed directly by the CPU.

Program Development Process Text editor Source code (.java) Saves Java statements Java compiler Is read by Byte code (.class) Produces Java Virtual Machine Is interpreted by Program Execution Results in

Portability A program is ___________________________ if it may be written on one type of computer and then run on a wide variety of computers, with little or no modification. Java byte code runs on the JVM and not on any particular CPU; therefore, compiled Java programs are highly portable. JVMs exist on many platforms: Windows Mac Linux

Portability A program is __portable________________ if it may be written on one type of computer and then run on a wide variety of computers, with little or no modification. Java byte code runs on the JVM and not on any particular CPU; therefore, compiled Java programs are highly portable. JVMs exist on many platforms: Windows Mac Linux

Portability With most programming languages, portability is achieved by compiling a program for each CPU it will run on. Java provides an JVM for each platform so that programmers do not have to recompile for different platforms.

Portability Byte code (.class) Java Virtual Machine for Windows Machine for Unix Java Virtual Machine for Linux Java Virtual Machine for Mac

How To Program (Our way) 1. Understand the problem 2. Visualize 3. Write down the algorithm on paper Informal high-level description of an algorithm Step1: … Step2: … 4. Translate to Java 5. Save and Compile 6. If does not compile then fix error, save and compile. 7. Run 8. Test code to make sure it works for all expected input