EKT150 INTRODUCTION TO COMPUTER PROGRAMMING

Slides:



Advertisements
Similar presentations
CS101: Introduction to Computer programming
Advertisements

CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Chapter 1 - An Introduction to Computers and Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Chapter 1 Program Design
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.
Computer Programming Basics. Computer programs are a detailed set of instructions given to the computer They tell the computer: 1. What actions you want.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
 2000 Prentice Hall, Inc. All rights reserved. 1 Introduction to Computers and C Programming Outline Introduction What Is a Computer? Computer Organization.
ITEC113 Algorithms and Programming Techniques Introduction to Programming.
Introduction to Computers and Programming
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
COMPUTER SCIENCE I C++ INTRODUCTION
ITEC113 Algorithms and Programming Techniques
CSE 1340 Introduction to Computing Concepts Class 2.
 2008 Pearson Education, Inc. All rights reserved Introduction to Computers, the Internet and World Wide Web.
Computer Programming I. Today’s Lecture  Components of a computer  Program  Programming language  Binary representation.
UniMAP Sem1-08/09EKT120: Computer Programming1 Week 1 – Lecture 1.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
C++ Programming Language Lecture 1 Introduction By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
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++
COMPUTER PROGRAMMING. Computer programming the objective of the module to gain the necessary skills to develop a computer program using one of the high.
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 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.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
UniMAP Sem I – 10/11EKT150: Computer Programming 1 Week 1 – Introduction to Computers and Programming Languages (Part 1) Pn. Rusnida bt. Romli & Che Muhammad.
CS2301:Computer Programming 2
Structured Programming (4 Credits)
The Hashemite University Computer Engineering Department
UniMAP Sem2-10/11 DKT121: Fundamental of Computer Programming1 Introduction to C – Part 1.
Week 1 Introduction to Computers and Programming Languages UniMAP Sem II – 12/13 EKT120: Computer Programming 1.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
1 Types of Programming Language (1) Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example:
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Chapter 1 Introduction 2nd Semester H
Problem Solving & Computer Programming
EKT150 INTRODUCTION TO COMPUTER PROGRAMMING
Week 1 – Introduction to Computers and Programming Languages (Part 1)
Introduction to Programming / chapter 3 / COM1022
Outline Introduction What Is a Computer? Computer Organization
Week 1 – Session 1 Pn. Yasmin Yacob 04 – KUKUM Sem2-06/07
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
C++ Programming: From Problem Analysis to Program Design
Unit# 9: Computer Program Development
(Course Introduction)
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 1 Introduction(1.1)
Understanding Problems and how to Solve them by using Computers
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Basic Concepts of Algorithm
ICS103 Programming in C 1: Overview of Computers And Programming
Presentation transcript:

EKT150 INTRODUCTION TO COMPUTER PROGRAMMING Introduction to Computer and Computer Programming Dr. Nik Adilah Hanin adilahhanin@unimap.edu.my

COURSE INFORMATION Contributes 3 units: Main Objective: 2 hours lectures 2 hours labs Main Objective: Students can independently write, read, compile, debug and execute computer programs to solve problems, especially engineering related problems.

COURSE OUTCOME Ability to define and describe programming concepts and principles. Ability to apply GNU/Linux for coding, compiling, executing and debugging computer programs. Ability to analyze and solve engineering related problems using computer programming techniques Ability to evaluate programming techniques and tools to design computer programs.

ASSESSMENT 4 main components: Theoretical Tests 20%‏ Lab Assignments 20% Lab Test 10% Final Exam 50%‏ Assignments are assessed individually (in lab assignment) Theoretical tests are written tests Attendances are compulsory!

REFERENCES Deitel & Deitel, “C How to Program”, International Edition, Pearson-Prentice Hall, 2010. Cheng, H., “C for Engineers and Scientists”, McGraw Hill, 2010. Hanly, J.R. and Koffman, E.B., “C Program Design for Engineers”, 2nd Ed., Addison-Wesley, 2001. ISBN : 0321204174

NOTES This course is NOT about the language per se, it is about analytical skills and to apply programming to solve problems. Write C program in Linux environment/GNU compiler applications Do early reading Do not hesitate to ask during lecture sessions How to download lecture notes and lab exercises from portal!!!

LECTURE OUTLINE Introduction to Computer Introduction to Computer Programming Introduction to C Programming Language

A Brief Look At Computer is a device that receives input, stores and processes data, and provides output in a useful format. Computers process data according to sets of instructions called computer programs Example: laptops, PCs, mainframes, mobile phones, washing-machines, TV sets, cars contain computers Hardware Physical components of a computer Example: Keyboard, screen, mouse, disks, memory, CD-ROM, and processing units Software Programs that run on a computer Example: Operating System such as windows XP -Vista -7, Word processing packages such as MS Word, registration program

Computer Hardware

Exercise: Distinguishing between input-process and output-storage The scenario: “At the end of each month, a clerk enters the employee name, number of days present and absent, and the number of overtime done in the system. The system then calculates the normal salary, the amount for overtime and the total salary. The clerk then saves the information in the computer hard disk, and takes a backup on a cd. A report is produced for the clerk to be shown to the manager. “ Task: Identify the following for that particular system Input Process(es) Output Storage

Exercise: Distinguishing between input-process and output-storage The scenario: “At the end of each month, a clerk enters the employee name, number of days present and absent, and the number of overtime done in the system. The system then calculates the normal salary, the amount for overtime and the total salary. The clerk then saves the information in the computer hard disk, and takes a backup on a cd. A report is produced for the clerk to be shown to the manager. “ Task: Identify the following for that particular system Input: the employee name, number of days present and absent, the number of overtime Process(es): calculate normal income, calculate amount for overtime, calculate total salary Output: Report Storage: Harddisk, CD-ROM

How Computer Processes Information? Computers are NOT intelligent Computers do what we tell them to do they don’t do anything by themselves. We must clearly tell a computer what to do in a step by step manner using a programming language. Computers only understand “electronic” High voltage/low voltage – The machine language Machine language is binary (two values: high/low) 1’s and 0’s

Why We Use Computer? Computers produce fast, accurate and reliable results. While computers do the boring, repetitive, ordinary tasks, we can spend our efforts and time to work on more interesting and creative tasks. The use of computers in business and manufacturing decreases the cost of goods and services produced. It is more difficult and needs more time to find or grow up a skill-full labour in IT industry, while buying an additional computer and installing the required software on is easier and cheaper.

INTRODUCTION TO COMPUTER PROGRAMMING

Programming / Program / Programmer Programming in general term is planning or implementation of a task or event command. In the computing field, is instructing a computer to perform specific tasks. Computer programming can be defined as the process of planning a set of sequence commands to be executed by a computer. Program be defined as a set of sequence commands that have been determined to be executed by a computer. Computers are just electronic devices that have the power to perform difficult tasks but they do not ‘KNOW’ what to do therefore - programmers tell the computers what to do by writing programs

Types of Programming Languages Machine language Strings of numbers giving machine specific instructions Example: +1300042774, +1400593419, +1200274027 Assembly language English-like abbreviations representing elementary computer operations (translated via assemblers) Example: LOAD BASEPAY, ADD OVERPAY High level language Codes similar to everyday English. Use mathematical notations (translated via compilers) Example Code: grossPay = basePay + overTimePay Example high level languages: C, C++, Java

Programming Problem Problem that can be solve using programming language. Suppose you want to add 34 and 56, this is easy. But to add 100 numbers is difficult for us need to use calculator or paper and pencil. Or we can write a program for computer to help us. Can these problems solve by computer programming? Converting units from kilograms to grams. Counting the number of cars on a highway. Finding a life partner Total rain in a week How long we live What we want to eat for dinner

Problem Solving using Programming

Steps of Programming Requirement Specification: Eliminate ambiguities, Clearly understand the problem Analyse the problem: Understand the inputs, outputs and processes used for manipulating the data, formulas and constraints Design: Write the algorithm (flowchart or pseudocode) to represent the solution Implement the algorithm: Write a program Testing and Verification: Check the program Documentation

Properties of Well Designed Programs Easy to maintain and update Well designed programs must : Correct and accurate Easy to understand Easy to maintain and update Efficient Reliable Flexible

INTRODUCTION TO C PROGRAMMING LANGUAGE

Programming Basics Computer programs are a detailed set of instructions given to the computer Programs are constructed based on an ALGORITHM which is an outline of how your computer program will work Algorithms are a problem solving procedure that consist of: What actions you want the computer to perform The order of those actions should happen in

Creating Algorithms To solve problem using algorithms, we have to: READ and understand the problem THINK about different solutions to the problem DESIGN an approach that will solve the problem IMPLEMENT that design TEST to see if it works If needed

Form of Algorithms The constructs used to build algorithms can be described in two different ways: Pseudo code Flowchart

1. Pseudo Code When the algorithm is written out as a well-thought series of steps, it is called PSEUDO CODE It is written in easy to understand language (i.e. ENGLISH) It is written very similar to the way that you would code it into your 3rd Generation Language (i.e. C Language)

Example 1: Pseudo Code Create a detailed set of instructions (pseudo-code) that will tell us: How to eat a banana Make your instructions as detailed as possible, so that even someone who has never eaten a banana before can understand them

INSTRUCTIONS OF HOW TO EAT A BANANA: Example 1: Pseudo Code INSTRUCTIONS OF HOW TO EAT A BANANA: Using your hand, get a yellow crescent-shaped fruit called a “banana” Peel the outer skin off the banana Eat the banana Put a small section of banana in your mouth Bite down on the banana Chew the banana by opening and closing your mouth Once the banana has been chewed, swallow the banana Repeat until banana is finished Throw out the used banana peel

The order of actions are very important! Example 2: Pseudo Code WAKE UP MAK MINAH 1 Get out of bed Take off pyjamas Take a shower Get dressed Eat breakfast Drive to school WAKE UP MAK MINAH 2 Get out of bed Take off pyjamas Get dressed Take a shower Eat breakfast Drive to school The order of actions are very important! RESULT Mak Minah arrives in a great mood ready to work  RESULT Mak Minah arrives in not too great a mood since she’s soaking wet 

2. Flow Chart The algorithm can also be written as a FLOW CHART The flow chart is a graphic organiser (a picture that helps organize your thoughts) It uses a collection of basic symbols that are used to organize your algorithm These symbols are connected by arrows that show how the algorithm “flows”

Visual Form of Flow Chart Flowchart: visual-form of an algorithm Example: Begin Input Data Process 1 Decision Process 2 Output Result End

Algorithms: Flow Chart BASIC SYMBOLS IN FLOW CHART TERMINAL: Start/End of a program PROCESSING: shows any mathematical operation (e.g. addition, substraction, etc) INPUT/OUTPUT: – where the user of the program is asked for information (INPUT) or where the program displays a result (OUTPUT) DECISION: represents any action where the computer is making a decision Flow direction

Algorithms: Pseudo Code & Flow Chart Example 1 Write an algorithm that display a message to the screen as “Hello World!”. Begin Print Message End Flow Chart Pseudo Code Begin Print “Hello World!” End

Algorithms: Pseudo Code & Flow Chart Example 2: Write a flowchart that calculates and prints the SUM of two integers A and B. Pseudo Code Flow Chart Begin Input A, B Calculate A + B Print SUM End Begin Input A and B Calculate A + B Print result of SUM End

Exercises Write an algorithm (pseudo code and flow chart) to read input of 3 test marks, calculate the average and display the final marks. Additional to (1), if the final marks is 60 and above, display mark and “Passed”, otherwise display mark and “Failed”.

Calculate average= (test1+test2+test3)/3 Answer Exercise (1) Pseudo Code Flow Chart Begin Begin Input test1, test2 and test3 Calculate average Print result of average End Input test1,test2 & test3 Calculate average= (test1+test2+test3)/3 Print Average End

Answer Exercise (2) Pseudo Code Flow Chart Begin Input test1, test2 and test3 Calculate average If average >=60 Display average & “Passed” Otherwise Display average & “Failed” End Input test1,test2 & test3 Calculate average= (test1+test2+test3)/3 Average >= 60 True False Display average and “Failed” Display average and “Passed” End

References Yuksel Uckan, “Problem Solving Using C, Structured Programming Techniques”, McGraw-Hill Deitel and Deitel, C: “How to Program”, McGraw-Hill Cheng, H., “C for Engineers and Scientists”, McGraw Hill, 2010 Hanly, J.R. and Koffman, E.B., “C Program Design for Engineers”, 2nd Ed., Addison-Wesley, 2001, ISBN : 0321204174