COSC 1P02 Intro. to Computer Science 1.1 Cosc 1P02 Week 1 Lecture slides "If a man does his best, what else is there?” General George S. Patton (1885-1945)

Slides:



Advertisements
Similar presentations
Senem Kumova Metin Introduction to Programming CS 115 Introduction to Computing PART I : Computer Basics PART II: Introduction to Computing/Programming.
Advertisements

ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Cosc 1P02 Week 2 Lecture slides
COSC 120 Computer Programming
Chapter 1: An Overview of Computers and Programming Languages J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program.
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.
Wednesday, 9/4/02, Slide #1 1 CS 106 Intro to CS 1 Wednesday, 9/4/02  Today: Introduction, course information, and basic ideas of computers and programming.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
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.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
Chapter 1 Introduction to Programming and the Java Language.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Programming Languages.
Topics Introduction Hardware and Software How Computers Store Data
INTRODUCTION TO COMPUTING
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computer Science.
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Lesson 1b: Computer Systems and Program Development CPS118.
CISC105 General Computer Science Class 1 – 6/5/2006.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
An Introduction to Computers August 12, 2008 Mrs. C. Furman.
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 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Intro to Computers Computer Apps 1.
COSC 1P02 Introduction to Computer Science 3.1 Cosc 1P02 Week 3 Lecture slides Birthdays are good for you. Statistics show that the people who have the.
Introduction to Computer Systems and the Java Programming Language.
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.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Yaohang Li.
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
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.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
CHAPTER 1 COMPUTER SCIENCE II. HISTORY OF COMPUTERS (1.1) Eniac- one of the worlds first computers Used more electricity than an entire city block of.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Chapter 1: Introduction to Computers and Programming.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Chapter 1: Introduction to Computers and Programming
Topics Introduction Hardware and Software How Computers Store Data
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

COSC 1P02 Intro. to Computer Science 1.1 Cosc 1P02 Week 1 Lecture slides "If a man does his best, what else is there?” General George S. Patton ( )

COSC 1P02 Intro. to Computer Science 1.2 COSC 1P02  Audience  planning to major in COSC  Staff  instructors: Dave Hughes (J312) & Dave Bockus (J324)  mentor: Baoling Bork (J304)  tutorial leader:  lab demonstrators:  Lectures (AS216), labs (J301), tutorials (AS203)  Web  COSC:  COSC 1P02:   Dave Hughes:  Dave Bockus:  Succeeding in COSC 1P02  labs/assignments

COSC 1P02 Intro. to Computer Science 1.3 Course Content and Procedures  All course documents available through Computer Science Website:   COSC home page:  Outline  Instructional labs  lab participation  Assignment preparation  Help Desk (J304)  submission (outside J332)  return (J333)  plagiarism  Exams/tests  lab vs written  course procedures  plagiarism plagiarism  students with computers  Software: JCreator or Dr. JavaDr. Java  Libraries  BasicIO  TurtleGraphics  Media

COSC 1P02 Intro. to Computer Science 1.4 Class Room  Ground Rules  Lecture conduct  Cell Phones  Laptops  Contact information:  messages only accepted from a Brock server.  Dave Bockus  Open Door Policy (J324, Day Section)   MSN

COSC 1P02 Intro. to Computer Science 1.5 Computer Science What is it?  study of computer hardware and algorithms and data structures and how they fit into information systems.  computer  programmable machine.  processes data into information.  Algorithm  well-defined sequence of steps to produce an outcome  programming language  Java Hardware Data InInfo Out Algorithm Software

COSC 1P02 Intro. to Computer Science 1.6 Hardware Components  processor (CPU)  control unit (CU)  controls system  follows instructions  arithmetic logic unit (ALU)  performs operations (e.g. +, -, =, <)  main memory (RAM)  volatile  input devices  transformation  keyboard, scanner, sensor

COSC 1P02 Intro. to Computer Science 1.7

COSC 1P02 Intro. to Computer Science 1.8 Hardware Components.  output devices  transformation  monitor, printer, actuator  auxiliary storage  hard disk, floppy disk, CD-ROM, DVD, Data Keys  communications  Networks ( wired, broadband)  modem, cable modem

COSC 1P02 Intro. to Computer Science 1.9 Data Representation  switches—bi-stable devices  binary system  positional (like decimal)  bit  byte  megabyte (MB)  memory organization  storage cell  address  store(write)/fetch(read) Address, where the info is located. Data, what is stored.

COSC 1P02 Intro. to Computer Science 1.10  All information is represented in binary code  numbers  characters  coding scheme  sound, images  Digitization  Important: bytes of data only differ in how they are interpreted.  The same byte can be viewed as:  Simple representation  Numbers (integers and floats)  Characters (abc…)  Part of Complex Objects  Pictures, sounds, video  Program  Machine Code which instructs the hardware.  Its all in the interpretation Data Representation (2)

COSC 1P02 Intro. to Computer Science 1.11 Instruction Processing  machine language  Opcode (operation code)  Operand (source data to be used in the operation)  CPU  registers  Special Registers IAR, IR  bus  machine (fetch/decode/execute) cycle  fetch  decode  execute  system clock  1 megahertz (Mhz) = 1,000,000 cycles/second

COSC 1P02 Intro. to Computer Science 1.12

COSC 1P02 Intro. to Computer Science 1.13

COSC 1P02 Intro. to Computer Science 1.14

COSC 1P02 Intro. to Computer Science 1.15 Fetch/Decode Cycle

COSC 1P02 Intro. to Computer Science 1.16 Coding Schemes

COSC 1P02 Intro. to Computer Science 1.17 Machine Language Assembly Language  First generation  One-to-one correspondence with hardware function  Binary representation  Operator (opcode)  Operands  Developed into Assembly by allowing mnemonics to represent the actual machine instructions.  made life easier for the programmers.

COSC 1P02 Intro. to Computer Science 1.18 High-level Language  Closer to problem domain  One-to-many translation  Code much easier to write and understand  Made writing large programs much easier.  Required:  Compiler  Takes source program  Converts to object program {something the machine can understand}  Libraries  linker  Compile time vs Link time vs Execution time

COSC 1P02 Intro. to Computer Science 1.19 Software  Software  computer program  instructions for machine execution  Compiler  Translation of a high level language into machine language.  Program preparation  edit  editor  compile  compiler  syntax errors  link  add in resources (code) from library  execute  execution (logic) errors (bugs)  Development environment (IDE, e.g. DrJava, JCreator)

COSC 1P02 Intro. to Computer Science 1.20 Computer Programming

COSC 1P02 Intro. to Computer Science 1.21 Java  Gosling ( )  Originally for consumer electronics  embedded systems  Platform independence  Object-oriented  programming as modeling  Java as a better C++  Execution of Java programs  platform independence  machine language?  Java bytecode  Java interpreter

COSC 1P02 Intro. to Computer Science 1.22 Java Programming Concepts  library (package)  e.g. Media  collection of useful classes  imported to be used  class  e.g. Turtle  definition of a kind of entity (object)  defines operations (methods) entities can perform  object  one entity from a class (a turtle)  created using new

COSC 1P02 Intro. to Computer Science 1.23  variable  e.g. yertle  name that refers to an object or value  method  e.g. forward  an operation that can be performed by an object  statement  a line of Java code  method call statement  request for an object to perform a method  object.methodName(parameters)  e.g. yertle.forward(40)

COSC 1P02 Intro. to Computer Science 1.24 Turtle Graphics  Simple graphics facility  Derived from Logo  TurtleDisplayer  a class in the BasicIO library  canvas of 300 by 300 drawing units  Turtle  a class in the Media library  draws on a canvas  Drawing a square  create displayer  create turtle  put turtle on canvas  put pen down  draw line  turn corner  repeat

COSC 1P02 Intro. to Computer Science 1.25 Assembly and Machine Language

COSC 1P02 Intro. to Computer Science 1.26 Executing an Assembly Language Program

COSC 1P02 Intro. to Computer Science 1.27 Executing a High-Level Language Program

COSC 1P02 Intro. to Computer Science 1.28 Turtle Displayer  This is equivalent to a piece of paper which the turtle will draw on.  Create the Displayer  Put the turtle on the Displayer  This also implies we can have more then 1 turtle on the same displayer.  Displayer and Turtle are resources provided by libraries.  We do not make the paper we use. We let someone else do this for us.  Code is linked in to our program  If you want a piece of paper you have to have a access to it.  Same for a pencil  Import statement allows us access to these libraries.

COSC 1P02 Intro. to Computer Science 1.29 A Java Program  Draw a square  Framework  a program is a class  code for a class is stored in a file  a class is part of a package  establish (import) environment (libraries)  define names (variables) being used  constructor is a method that is executed when an object is created  contains actions (statements) to be performed  main method creates an instance of the DrawSquare class to begin execution

COSC 1P02 Intro. to Computer Science 1.30 package Example_2_1; import BasicIO.*; import Media.*; import static java.lang.Math.*; public class DrawSquare { private TurtleDisplayer display; // display to draw on private Turtle yertle; // turtle to do drawing public DrawSquare ( ) { display = new TurtleDisplayer(); yertle = new Turtle(); display.placeTurtle(yertle); yertle.penDown(); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.penUp(); display.close(); }; // constructor public static void main ( String[] args ) { new DrawSquare(); }; } Import, make libraries visible. Declare the variable display & yertle. Create the Objects we need to use, Drawing Surface -> display and the Turtle -> yertle. Use yertle by calling methods. Put the Turtle on the Surface. Basic Program Components

COSC 1P02 Intro. to Computer Science 1.31 Draw Square Program Flow package Example_2_1; import BasicIO.*; import Media.*; import static java.lang.Math.*; /** This class is a program to draw a square using Turtle Graphics. * D. Hughes * 1.0 (July 2007) * * new concepts: java program structure, declarations, constructor, object creation, * object assignment, method calls, turtle displayer, turtle graphics */ public class DrawSquare { private TurtleDisplayer display; // display to draw on private Turtle yertle; // turtle to do drawing public DrawSquare ( ) {/** The constructor. */ display = new TurtleDisplayer(); yertle = new Turtle(); display.placeTurtle(yertle); yertle.penDown(); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.forward(40); yertle.right(PI/2); yertle.penUp(); display.close(); }; // constructor public static void main ( String[] args ) { new DrawSquare(); }; } Program starts by creating a new Square Object Variables declared in the class body are called instance variables. Each new Object will have its own instance variables. display yertle Yertle is instructed to put its pen down and draw a square. Wait until the display close button is pressed, then exit Constructor finishes and program ends

COSC 1P02 Intro. to Computer Science 1.32 TurtleDisplayer Methods

COSC 1P02 Intro. to Computer Science 1.33 Turtle Methods

COSC 1P02 Intro. to Computer Science 1.34 The end