SME1013 PROGRAMMING FOR ENGINEERS

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
Chapter 2: Problem Solving
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
INTRODUCTION TO PROGRAMMING
Programming Fundamentals (750113) Ch1. Problem Solving
Algorithm & Flowchart Credit: Mr Ainullotfi.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
PRE-PROGRAMMING PHASE
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
CSC141 Introduction to Computer Programming
CSC-115 Introduction to Computer Programming
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
Programming Lifecycle
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
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.
IXA 1234 : C++ PROGRAMMING CHAPTER 1. PROGRAMMING LANGUAGE Programming language is a computer program that can solve certain problem / task Keyword: Computer.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
1 Program Planning and Design Important stages before actual program is written.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Programming at a high level. Developing a Computer Program Programmer  Writes program in source code (VB or other language) Compiler  Converts source.
Fundamentals of Algorithms MCS - 2 Lecture # 5. Representation of Algorithms (continued) Flowcharts.
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
PROGRAMMING FUNDAMENTALS INTRODUCTION TO PROGRAMMING. Computer Programming Concepts. Flowchart. Structured Programming Design. Implementation Documentation.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
Chapter 1 Introduction 2nd Semester H
Algorithm & Flowchart.
Flow Charts Basic Flow Chart Symbols Few sample flowcharts Rules
Introduction to programming
Computer Programming.
Programming Mehdi Bukhari.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Algorithms and Flowcharts
Algorithms An algorithm is a sequence of steps written in the form of English phrases that specific the tasks that are performed while solving the problem.It.
Lecture 2 Introduction to Programming
Introduction To Flowcharting
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Chapter 1: An Overview of Computers and Programming Languages
Algorithm and Ambiguity
ALGORITHMS AND FLOWCHARTS
Unit# 9: Computer Program Development
Problem Solving Techniques
Introduction to Systems Analysis and Design
Programming Fundamentals (750113) Ch1. Problem Solving
Programming Fundamentals (750113) Ch1. Problem Solving
ALGORITHMS AND FLOWCHARTS
Chapter 2- Visual Basic Schneider
Introduction to Algorithms and Programming
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)
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Faculty of Computer Science & Information System
Chapter 2- Visual Basic Schneider
ME 142 Engineering Computation I
SME1013 PROGRAMMING FOR ENGINEERS
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.
Programming Fundamentals (750113) Ch1. Problem Solving
ICT Gaming Lesson 2.
Tonga Institute of Higher Education IT 141: Information Systems
Programming Fundamentals (750113) Ch1. Problem Solving
Chapter 1: Preliminaries
Tonga Institute of Higher Education IT 141: Information Systems
Basic Concepts of Algorithm
ICS103 Programming in C 1: Overview of Computers And Programming
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

SME1013 PROGRAMMING FOR ENGINEERS Ainullotfi bin Abdul Latif Faculty of Mechanical Engineering UTM

SME1013 Programming for Engineers Problem Solving Recognise and understand the problem (what is it that needed to be solved?) List the parameters affecting the problem (input) Select the appropriate theory Make the necessary assumptions Solve the problem – may use a computer Verify the results 10-Dec-18 SME1013 Programming for Engineers

Computer Solution: Software Development Process List down the sequence of steps to solve the problem – algorithm Write these steps in a computer language – program coding Test the program to ensure it error-free and reliable – debugging Make the program easy to understand and use – documentation Save the program and improve it as one gathers experience 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Computer Coding A program is a sequence of instructions to the computer for it to solve a particular problem. A set of programs is called code. Programs are written in some programming language – e.g. Fortran, Basic, C++, Pascal, Java, Matlab. Programs are stored in files – which are a sequence of bytes which is given a name and stored on a disk. 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Computer Coding A bit or a binary digit is the smallest unit of data storage. It has the value of either 0 or 1 only. A byte is a sequence of 8 bits, representing 256 different values. E.g. of a byte is: 0 1 0 1 1 1 0 1 A byte could represent a character like a letter or a number or a symbol. A word is a larger group of bytes, maybe two bytes (16 bits). 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Computer Coding A program is a file containing a sequence of “statements”, each of which tells the computer to do a specific action. Once a program is run or executed the commands are followed and actions occur in a sequential manner. If the program is designed to interact with the outside world, then it must have input and output. 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Computer Coding A program is said to have a bug if it contains a mistake or it does not function in the way it is intended to. Bugs can happen both in the logic of the program, as well as in the commands. In order that the program perform the exact actions it is intended to do, before the actual program is written an algorithm for solving the problem must first be outlined. 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Computer Coding An algorithm is a general sequence of the logical steps in solving a specific problem. A flowchart is a graphical representation of the algorithm. A pseudocode gives a more detailed, step-by-step set of instructions required to solve the problem. It is normally written in everyday language. 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Good Algorithms Each step must be deterministic – it cannot be ambiguous or leaving things to chance. The process must end after a finite number of steps – it must not be open-ended. The algorithm must be general enough to deal with any contingency. 10-Dec-18 SME1013 Programming for Engineers

Common Flowchart Symbols Start/Stop Process Input/Output Refers to a separate flowchart Decision Connector Off-page Connector Preparation (for loops etc) 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Example Problem #1 Given temperature in degrees Fahrenheit, the temperature in degrees Kelvin is to be computed and shown. Formula: TK and TF are temperatures in degrees Kelvin and Fahrenheit respectively 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Algorithm Start Get the temperature in Fahrenheit Compute the temperature in Kelvin using the formula Show the temperature in Kelvin Stop 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Flowchart Start Get TF Show TK Stop 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Pseudocode 1. Start 2. Get TF 3. TK = (TF-32)/1.8 + 273.15 4. Show TK 5. Stop 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Example Problem #2 Given a set of numbers, calculate their sum and the average value (mean). Formula: n is the number of numbers in the set 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Algorithm 1. Start 2. Get one number in the set 3. Count the numbers as it is obtained 4. If there are still numbers to be obtained, go back to step 2. 5. Sum the numbers in the set 6. Divide the sum by the number of numbers in the set to get the average 7. Show the sum and the average 8. Stop 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Flowchart Start Get number Calculate mean Show sum and mean Stop Count number Any more number? Calculate sum Yes No 10-Dec-18 SME1013 Programming for Engineers

SME1013 Programming for Engineers Detailed Flowchart Start Get xi Mean = sum/n Show sum and mean Stop i ← i + 1 Any more number? Yes No i ← 0 n ← i sum ← 0 j ← 0 j ← j + 1 Is j  n? sum ← sum + xj 10-Dec-18 SME1013 Programming for Engineers