ITEC113 Algorithms and Programming Techniques

Slides:



Advertisements
Similar presentations
Request Dispatching for Cheap Energy Prices in Cloud Data Centers
Advertisements

SpringerLink Training Kit
Luminosity measurements at Hadron Colliders
From Word Embeddings To Document Distances
Choosing a Dental Plan Student Name
Virtual Environments and Computer Graphics
Chương 1: CÁC PHƯƠNG THỨC GIAO DỊCH TRÊN THỊ TRƯỜNG THẾ GIỚI
THỰC TIỄN KINH DOANH TRONG CỘNG ĐỒNG KINH TẾ ASEAN –
D. Phát triển thương hiệu
NHỮNG VẤN ĐỀ NỔI BẬT CỦA NỀN KINH TẾ VIỆT NAM GIAI ĐOẠN
Điều trị chống huyết khối trong tai biến mạch máu não
BÖnh Parkinson PGS.TS.BS NGUYỄN TRỌNG HƯNG BỆNH VIỆN LÃO KHOA TRUNG ƯƠNG TRƯỜNG ĐẠI HỌC Y HÀ NỘI Bác Ninh 2013.
Nasal Cannula X particulate mask
Evolving Architecture for Beyond the Standard Model
HF NOISE FILTERS PERFORMANCE
Electronics for Pedestrians – Passive Components –
Parameterization of Tabulated BRDFs Ian Mallett (me), Cem Yuksel
L-Systems and Affine Transformations
CMSC423: Bioinformatic Algorithms, Databases and Tools
Some aspect concerning the LMDZ dynamical core and its use
Bayesian Confidence Limits and Intervals
实习总结 (Internship Summary)
Current State of Japanese Economy under Negative Interest Rate and Proposed Remedies Naoyuki Yoshino Dean Asian Development Bank Institute Professor Emeritus,
Front End Electronics for SOI Monolithic Pixel Sensor
Face Recognition Monday, February 1, 2016.
Solving Rubik's Cube By: Etai Nativ.
CS284 Paper Presentation Arpad Kovacs
انتقال حرارت 2 خانم خسرویار.
Summer Student Program First results
Theoretical Results on Neutrinos
HERMESでのHard Exclusive生成過程による 核子内クォーク全角運動量についての研究
Wavelet Coherence & Cross-Wavelet Transform
yaSpMV: Yet Another SpMV Framework on GPUs
Creating Synthetic Microdata for Higher Educational Use in Japan: Reproduction of Distribution Type based on the Descriptive Statistics Kiyomi Shirakawa.
MOCLA02 Design of a Compact L-­band Transverse Deflecting Cavity with Arbitrary Polarizations for the SACLA Injector Sep. 14th, 2015 H. Maesaka, T. Asaka,
Hui Wang†*, Canturk Isci‡, Lavanya Subramanian*,
Fuel cell development program for electric vehicle
Overview of TST-2 Experiment
Optomechanics with atoms
داده کاوی سئوالات نمونه
Inter-system biases estimation in multi-GNSS relative positioning with GPS and Galileo Cecile Deprez and Rene Warnant University of Liege, Belgium  
ლექცია 4 - ფული და ინფლაცია
10. predavanje Novac i financijski sustav
Wissenschaftliche Aussprache zur Dissertation
FLUORECENCE MICROSCOPY SUPERRESOLUTION BLINK MICROSCOPY ON THE BASIS OF ENGINEERED DARK STATES* *Christian Steinhauer, Carsten Forthmann, Jan Vogelsang,
Particle acceleration during the gamma-ray flares of the Crab Nebular
Interpretations of the Derivative Gottfried Wilhelm Leibniz
Advisor: Chiuyuan Chen Student: Shao-Chun Lin
Widow Rockfish Assessment
SiW-ECAL Beam Test 2015 Kick-Off meeting
On Robust Neighbor Discovery in Mobile Wireless Networks
Chapter 6 并发:死锁和饥饿 Operating Systems: Internals and Design Principles
You NEED your book!!! Frequency Distribution
Y V =0 a V =V0 x b b V =0 z
Fairness-oriented Scheduling Support for Multicore Systems
Climate-Energy-Policy Interaction
Hui Wang†*, Canturk Isci‡, Lavanya Subramanian*,
Ch48 Statistics by Chtan FYHSKulai
The ABCD matrix for parabolic reflectors and its application to astigmatism free four-mirror cavities.
Measure Twice and Cut Once: Robust Dynamic Voltage Scaling for FPGAs
Online Learning: An Introduction
Factor Based Index of Systemic Stress (FISS)
What is Chemistry? Chemistry is: the study of matter & the changes it undergoes Composition Structure Properties Energy changes.
THE BERRY PHASE OF A BOGOLIUBOV QUASIPARTICLE IN AN ABRIKOSOV VORTEX*
Quantum-classical transition in optical twin beams and experimental applications to quantum metrology Ivano Ruo-Berchera Frascati.
The Toroidal Sporadic Source: Understanding Temporal Variations
FW 3.4: More Circle Practice
ارائه یک روش حل مبتنی بر استراتژی های تکاملی گروه بندی برای حل مسئله بسته بندی اقلام در ظروف
Decision Procedures Christoph M. Wintersteiger 9/11/2017 3:14 PM
Limits on Anomalous WWγ and WWZ Couplings from DØ
Presentation transcript:

ITEC113 Algorithms and Programming Techniques Introduction to Programming

What is a computer Computer Hardware Software 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, even everyday objects such as 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 ITEC113 Lecture Notes 1

Exercise : Distinguishing between input-process-output-storage 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 so that the latter can show to the manager. Identify the following for that particular system the employee name, number of days present and absent, the number of overtime Input Process(es) Output Storage referenceŞ http://wikieducator.org/User:Tzaynah/TComputingCourse calculate normal income, calculate amount for overtime, calculate total salary Report Hard disk, CD ITEC113 Lecture Notes 1

What is a computer? Computers are NOT intelligent or telepathic 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 understand “electronic” High voltage/low voltage Machine language is binary (two values: high/low) 1’s and 0’s ITEC113 Lecture Notes 1

Why are we using Computers? 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 skillful labor in IT industry, while buying an additional computer and installing the required software on is easier and cheaper. ITEC113 Lecture Notes 1

Need for Programming Computers are just electronic devices that have the power to perform difficult tasks but they do not ‘KNOW’ what to do. Programmers tell the computers what to do by writing programs ITEC113 Lecture Notes 1

Types of Programming languages ITEC113 Lecture Notes 1

Three types of programming languages 1.Machine languages Strings of numbers giving machine specific instructions Example: +1300042774 +1400593419 +1200274027 ITEC113 Lecture Notes 1

Types of Programming languages Three types of programming languages (continued) 2. Assembly languages English-like abbreviations representing elementary computer operations (translated via assemblers) Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY ITEC113 Lecture Notes 1

Types of Programming languages Three types of programming languages (continued) 3. High-level languages Codes similar to everyday English Use mathematical notations (translated via compilers) Example Code: grossPay = basePay + overTimePay Example high level languages: C, C++, Cobol, Java, Pascal (Delphi), Basic (Visual Basic) Fortran, SQL, T-SQL, C# … ITEC113 Lecture Notes 1

Use of programs to solve problems ITEC113 Lecture Notes 1

What is Data, Information and Knowledge ? Data are the raw facts, gathered from the environment which does not have much meaning. Note: Data is plural, singular form is Datum. Information is the end product of the processing of data, which has more meaning, and is used in decision making. Knowledge is the proved and generalized form of information, that is used in strategic planning. Data is raw material for data processing. data relates to fact, event and transactions. Information is data that has been processed in such a way as to be meaningful to the person who receives it. it is any thing that is communicated. for example: researchers who conduct market research survey might ask member of the public to complete questionnaires about a product or a service. These completed questionnaires are data; they are processed and analyze in order to prepare a report on the survey. This resulting report is information. THAT'S ALL ITEC113 Lecture Notes 1

What is Data, Information and Knowledge ? ITEC113 Lecture Notes 1

What is a Computer Program? A computer program is a set of instructions written in a computer language executed to perform a specific task. Also called SOFTWARE There are tens of programming languages, used nowadays. C, C++, C#, Pascal, Delphi, Visual Basic, Java, COBOL, FORTRAN, LISP, Prolog … ITEC113 Lecture Notes 1

Who is a Programmer? A programmer is a person who writes the required computer programs. Programmers translate the expected tasks given in a form we can understand into a form machines can understand Register students in EMU Registration program written in Delphi ITEC113 Lecture Notes 1

Types of Errors Syntax Errors: Violation of syntactic rules in a Programming Language generates syntax errors. Effect? Compiler helps user to identify the Syntax error and correct it Semantic Errors: Doing logical mistakes causes semantic errors . Effect? The Compiler can not notice these errors, but on execution, they cause unexpected wrong results. These errors can only be corrected by the careful programmer Run-time Errors: Occur on program execution. Mostly caused by invalid data entry or tries to use not existing resources. ( E.g. Attempting to divide a number by 0 ) Effect? It occurs on run time and may crash the program execution. ITEC113 Lecture Notes 1

ITEC113 Lecture Notes 1

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

Well designed programs must be Correct and accurate Easy to understand Easy to maintain and update Efficient Reliable Flexible ITEC113 Lecture Notes 1

Steps involved in Programming Requirement Specification: Eliminate ambiguities Clearly understand the problem Analyze 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 Testing and verification : Check the algorithm. Implement the algorithm : Write a program Testing and Verification: Check the program Documentation ITEC113 Lecture Notes 1

What is an Algorithm? An algorithm is the plan for writing a program. Steps required for solving a problem are listed by using an algorithm tool. Algorithm tools make program solutions more clear, more understandable, and easier to remember. Algorithms are written according to rules so that other programmers are also able to read and understand the solution easily. ITEC113 Lecture Notes 1

Tools of Algorithms There are many Algorithm tools in use, but the most popular ones are Pseudo-Codes and Flowcharts. In this course for all problems we will use both of these tools but in general you choose only one. ITEC113 Lecture Notes 1

Biker’s Dream Life ITEC113 Lecture Notes 1

Daily Routine of Students ITEC113 Lecture Notes 1

Flowcharts Flowcharts are graphical tools, containing a set of shapes, each expressing a different action in a sequence of program execution. There are many different shapes that are used for specific purposes, to avoid complexity, in this course, only a limited subset of these shapes will be shown and used in applications. ITEC113 Lecture Notes 1

Flowcharting Shapes Start End Every flowchart has to start with a TERMINAL shape containing the caption START and has to end with another TERMINAL shape containing the caption of END. INPUT shape is used to indicate manual input or reading values from keyboard. OUTPUT shape is used to indicate producing printed output to the user. DISPLAY shape is used to indicate that a value is sent to the monitor. Student Id Student Transcript cgpa ITEC113 Lecture Notes 1

Flowcharting Shapes PROCESS shape is used to represent assignments and manipulations of data such as arithmetic operations. DECISION shape represents the comparison of two values. Alternating course of actions is followed depending on the result of the criteria. CONNECTOR symbol is used to show the connections of two pages, when your design occupies more then one page. Also used to collect together flow lines of decision shape. FLOWLINE symbol is used to show the direction of the program flow between other symbols. Num 3 cgpa > 2.00 A ITEC113 Lecture Notes 1

Flowcharting Shapes ITEC113 Lecture Notes 1

Use of Connectors NO YES NO YES YES NO NO YES ITEC113 Lecture Notes 1

Pseudocode Pseudocode is structured english that is used as an alternative method to flowcharts for planning structured programs. There are no general accepted standards for pseudocodes. We will work with a form that has minimum number of rules and is essentially language-independent. Pseudo-code instructions are written in English, they can be easily understood and reviewed by users. The only syntax rules to be concerned with involve the LOOP and SELECTION structures. They must be used as CAPITALISED words. ITEC113 Lecture Notes 1

Exercises1 1- Write an algorithm that will ask user to input a number then your design will calculate and display the square of ınput number: S1) Input num S2) sqnum*num S3) Display sq ITEC113 Lecture Notes 1

Exercises2 2- Write an algorithm that will ask user to input height in meters then your design will convert and display the cm value of input number: S1) Input meter S2) cmmeter*100 S3) Display cm ITEC113 Lecture Notes 1

References CPIT/CSIT113 Lecture Notes, Mustafa Tuncel, Akile Yuvka, Yesim Kapsil Yuksel Uckan, Problem Solving Using C,Structured Programming Techniques, McGraw-Hill Deitel and Deitel, C: How to Program, McGraw-Hill ITEC113 Lecture Notes 1