1 Administrivia Lecture hours –Monday, Wednesday, Thursday: 11-11:55am, in L7 –Come to the class in time Labs –2pm-5pm, –Monday: A5-A6, Tuesday: A7-A8,

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Chapter 11 Introduction to Programming in C
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
Test on Input, Output, Processing, & Storage Devices
Introduction to Programming G51PRG University of Nottingham Revision 1
The simple built-in data types of the C language such as int, float, - are not sufficient to represent complex data such as lists, tables, vectors, and.
L2:CSC © Dr. Basheer M. Nasef Lecture #2 By Dr. Basheer M. Nasef.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
 2005 Pearson Education, Inc. All rights reserved Introduction.
CSE Spring 2015 INTERMEDIATE PROGRAMMING
INTRODUCTION T.Najah Al_Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System CS240.
10-Jun-15 Introduction to Primitives. 2 Overview Today we will discuss: The eight primitive types, especially int and double Declaring the types of variables.
Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
CS 61C L02 Number Representation (1)Harvey / Wawrzynek Fall 2003 © UCB 8/27/2003  Brian Harvey ( John Wawrzynek  (Warznek) (
1 Engineering Problem Solving With C++ An Object Based Approach Fundamental Concepts Chapter 1 Engineering Problem Solving.
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
 2002 Prentice Hall. All rights reserved. 1 Intro: Java/Python Differences JavaPython Compiled: javac MyClass.java java MyClass Interpreted: python MyProgram.py.
1 Lecture-2 CS-120 Fall 2000 Revision of Lecture-1 Introducing Computer Architecture The FOUR Main Elements Fetch-Execute Cycle A Look Under the Hood.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
C programming Language and Data Structure For DIT Students.
Chapter 3: Introduction to C Programming Language C development environment A simple program example Characters and tokens Structure of a C program –comment.
Binary Numbers.
Chapter 1 - Introduction. Ch 1Goals To understand the activity of programming To learn about the architecture of computers To learn about machine code.
Programming a computer. What does programming a computer mean ? Programming a computer: Since a computer can only execute machine instructions (encoded.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Introducing Java.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
1 Please switch off your mobile phones. 2 Prolog: The Initiation ET: Hey Alice! What is this on your desk? Alice: That’s a digital computer. ET: Digital.
CSE 1340 Introduction to Computing Concepts Class 2.
CS 1 •This is Computer Science 1. •Who is Professor Adams?
CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.
1 Agenda Administration Background Our first C program Working environment Exercise Memory and Variables.
Week 1 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
UniMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Lecture 1.
Introduction to Computer Systems and the Java Programming Language.
1 Please switch off your mobile phones. 2 WELCOME To ESC101N: Fundamentals of Computing Instructor: Mainak Chaudhuri
CS 140 Computer Programming (I) Second semester (3 credits) Imam Mohammad bin Saud Islamic University College of Computer Science and Information.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
1 Operators and Expressions Instructor: Mainak Chaudhuri
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 CS1430: Programming in C++ Section 2 Instructor: Qi Yang 213 Ullrich
Textbook C for Scientists and Engineers © Prentice Hall 1997 Available at NUS CO-OP at S$35.10.
UniMAP Sem2-10/11 DKT121: Fundamental of Computer Programming1 Introduction to C – Part 1.
Computer Programming for Engineers CMPSC 201C Fall 2000.
WELCOME To ESC101N: Fundamentals of Computing Instructor: Ajai Jain
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Chapter 1 Introduction 2nd Semester H
The need for Programming Languages
Engineering Problem Solving With C An Object Based Approach
Week 1 – Session 1 Pn. Yasmin Yacob 04 – KUKUM Sem2-06/07
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
CS1001 Programming Fundamentals 3(3-0) Lecture 2
CS190/295 Programming in Python for Life Sciences: Lecture 1
Computer Science I CSC 135.
Chapter 2 - Introduction to C Programming
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

1 Administrivia Lecture hours –Monday, Wednesday, Thursday: 11-11:55am, in L7 –Come to the class in time Labs –2pm-5pm, –Monday: A5-A6, Tuesday: A7-A8, Wednesday: A9- A10, Thursday: A1-A2, Friday: A3-A4 –The lab starts on Tuesday Jan 2, Since Jan 1 is a holiday, the Monday lab shall be held on Saturday (Jan 6) during 2-5pm. –The lab schedule is given on the course web-page ( Tutorial –Tuesday 11-11:55am, Tutorial Block –First tutorial on Tuesday Jan 2, 2007.

2 Administrivia Grading: –Exam: –Two compulsory lab tests: (Note: Performance in Lab tests will be taken into consideration while deciding about borderline cases) –Weekly lab sessions: 10 –Tutorials: 5 –Quizzes: 10 (extra credit)

3 Administrivia The course web page will have all relevant info about the course. You should keep checking the web-page for all updates: Text book –Nothing specific: your choice –Suggestion: “Java Elements: Principles of Programming in Java” by Bailey and Bailey –More references are on the webpage You may also visit past course sites through

4 What this course is not about This is not a course on programming –You will learn how to solve problems with computers: especially the ones that you cannot solve with paper and pencil quickly –The greater part of the lectures will be devoted to the concepts involved in developing a computer algorithm Sequence of steps that solve a problem –Java will be used as a vehicle to demonstrate the concepts Do not expect to become an expert in Java after taking this course

5 Algorithm The way out is to give a recipe that describes how to obtain the right output from any given input. We use the term algorithm to denote such recipes. Examples: algorithm to multiply two arbitrary integers, algorithm to find the gcd of two integers, etc. For every possible input, an algorithm specifies a sequence of steps which when carried out will give us the output that corresponds to the input. –Although on an input instance an algorithm may specify an arbitrary number of steps to be carried out, the algorithm itself must be finite. – Another property an algorithm must have is that each step it specifies must be effective, that is, it should be possible for the computing agent to carry out the step.

6 Algorithm Consider the problem of computing the product of two numbers by repeated addition. Suppose n1 and n2 are the two numbers, n2 non-negative, then we can find the product by adding n1 n2 times. We will assume for this problem that our computing agent can add two numbers, but arbitrary number of numbers, at any step. With this constraint, an algorithm is: Step 1. Read in the values of n1 and n2. Step 2. Initialize result to 0. Step 3. While n2 is greater than 0, do Steps 4 and 5 Step 4. Obtain the new value of result as (old value of result + n1) Step 5. Obtain the new value of n2 as (old value of n2 -1) Step 6. Print result. (At this point, result = n1*n2).

7 Flowchart

8 Programs Algorithms are informal objects, these are written using natural languages. Although, an algorithm is precise enough for a human being to follow, electronic computers cannot understand these, hence it cannot follow an algorithm to compute an output corresponding to a given input. It needs the algorithm translated in terms of the instructions it is capable to carry out. An algorithm, when translated in terms of what a computer can comprehend, what we have is a program.

9 Anatomy of a computer What you see –A monitor, a keyboard, a mouse, a printer … –Input/Output devices –Through these you ask the computer to do something and the computer tells you the results Need a way to convey your commands to the computer (it is really a stupid device which cannot do anything on its own) –Internally A central processing unit and a scratchpad (often called main memory) accomplish the job

10 Anatomy of a computer Central processing unit does not understand English, not even Java –It only understands two symbols: 0 and 1 –These are called bits (short for binary digits) –You encode your algorithm into a high-level language called Java This is called a program This is harder to understand than English, but easier to understand than a 0-1 encoding How do I encode a program in 0-1? This is used only for storing the program in main memory

11 Anatomy of a computer A friend of yours called compiler translates the program into a binary encoding called an object program –This is almost understandable to the central processing unit (often called a microprocessor) Another friend of yours called a linker adds something more to an object program to convert it to an executable –This is understandable to the CPU –But somehow it needs to get started executing

12 Anatomy of a computer A big boss called operating system loads the executable in main memory and hands over the control to the CPU –Now the CPU starts executing your program (essentially the binary executable) –Once in a while it prints something on the monitor and you appreciate that Notice that it is not doing anything on its own, only doing whatever you have asked it to do –At some point the CPU completes the execution and you have all the results

13 A simple program Let’s write a program in English (almost) –Want to add five numbers a, b, c, d, e and print the result on monitor print (monitor, a+b+c+d+e) –print is used as a function which takes two arguments: where to print and what to print –A binary translation of this could convert each character i.e. p, r, i, n, t, (, m, … into a binary string e.g., p is the 16 th alphabet, so represent it as 16 zeros; put a 1 to mark the end of a character –Now I can design a CPU which can understand this translation and execute my program (caution: this is just an example)

14 Printing on monitor /* Example of multiline comment; This is our first Program */ class printcoursename{ public static void main(String arg[]){ // This prints name of the course (single line comment) System.out.println("This course is ESc101N"); }

15 Printing on monitor /* Example of multiline comment; This is our second Program. Will print the same thing in a different way. */ class printcoursename{ public static void main(String arg[]){ // This prints name of the course (single line comment) System.out.println("This ” + “course ” + “is ” + “ESc101N”); }

16 Printing numbers class printnumber { public static void main (String args[]){ // Notice that I can use args also // because it is a variable name and can be // anything. int var1; // Declaration var1 = 124; // Operator and expression System.out.println("Value of var1 is: "+var1); }

17 Lab #1 Learn to use the UNIX environment –How to create a file (this where you store your programs) –How to create and navigate through directory (this where you store your files) –How to copy files from one directory to another –And more: –Lab is upstairs in CC: Your tutor will be there in the lab.