CP1020 University of Wolverhampton - Steve Garner and Ian Coulson1 Week 1 - Principles of programming Welcome from the Presenters Steve Garner and Dr Ian.

Slides:



Advertisements
Similar presentations
VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
Advertisements

1 CS101 Introduction to Computing Lecture 17 Algorithms II.
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
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
CP Week 10 Modularising programs using Procedures.
1 Outline 13.1Introduction 13.2A Simple Program: Printing a Line of Text in a Web Page 13.3Another JavaScript Program: Adding Integers 13.4Memory Concepts.
CP Week 4 Making Decisions. CP1020 ©University of Wolverhampton - Ian Coulson & Steve Garner Decisions Example: Driving to a lecture you notice.
CP Week 2 zReserved words zVariables zInput and output zData types zTesting and Documentation.
CP1020 Week 5 Selection Continued. CP1020 University of Wolverhampton - Steve Garner and Ian Coulson if then else zWe can use if then else statements.
Developing Software Applications Introduction to Programming Fundamentals Scoping in VB Simple Ifs in VB.
School of Computing Science CMT1000 © Ed Currie Middlesex University Lecture 3: 1 CMT1000: Introduction to Programming Ed Currie Lecture 3: Program structure.
School of Computing Science CMT1000 Ed Currie © Middlesex University Lecture 4: 1 CMT1000: Introduction to Programming Ed Currie Lecture 5a: Input and.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Introduction to a Programming Environment
CP1020 ©University of Wolverhampton - Ian Coulson & Steve Garner CP Week 3 zArithmetic operations zOperator precedence  Simple QBasic functions.
CP Week 7 Looping constructs Aims and Objectives zUnderstand what the while group of loops are and why they are needed zBe able to design and code.
Copyright © 2001 by Wiley. All rights reserved. Chapter 1: Introduction to Programming and Visual Basic Computer Operations What is Programming? OOED Programming.
Chapter 1: Introduction To Computer | SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2005 | Last Updated: July 2005 Slide 1 Introduction To Computers.
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
An Introduction to Textual Programming
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Introduction to Python
INTRODUCTION TO ALGORITHMS PROGRAMMING. Objectives Give a definition of the term algorithm Describe the various parts of the pseudocode algorithm or algorithm.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #002 (January 17, 2015)
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Software Life Cycle What Requirements Gathering, Problem definition
1 Special Programming Workshop CSIT-120 Fall 2000 Workshop Targets Solving problems on computer Programming in C++ Writing and Running Programs Programming.
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.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
C++ Programming Language Lecture 2 Problem Analysis and Solution Representation By Ghada Al-Mashaqbeh The Hashemite University Computer Engineering Department.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Pseudocode. Simple Program Design, Fourth Edition Chapter 2 2 Objectives In this chapter you will be able to: Introduce common words, keywords, and meaningful.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Procedural Programming. Programming Process 1.Understand the problem 2.Outline a general solution 3.Decompose the general solution into manageable component.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
Introducing C++ Programming Lecture 3 Dr. Hebbat Allah A. Elwishy Computer & IS Assistant Professor
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
Introduction to programming Carl Smith National Certificate Year 2 – Unit 4.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 3 Useful Python Elements for Designing Programs Some material based on material from Marty Stepp, Instructor, University.
Conditionals Opening Discussion zWhat did we talk about last class? zDo you have any questions about the assignment? zPass by value limitations.
 Software Development Life Cycle  Software Development Tools  High Level Programming:  Structures  Algorithms  Iteration  Pseudocode  Order of.
The Hashemite University Computer Engineering Department
JavaScript 101 Introduction to Programming. Topics What is programming? The common elements found in most programming languages Introduction to JavaScript.
C OMPUTER P ROGRAMMING 1 Input and Variables. I/O S TATEMENTS : I NPUT & V ARIABLES Input is the term used to describe the transfer of information from.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
COMPUTER PROGRAMMING Year 9 – lesson 1. Objective and Outcome Teaching Objective We are going to look at how to construct a computer program. We will.
Selection Using IF THEN ELSE CASE Introducing Loops.
Low-Level Programming Languages, Pseudocode and Testing Chapter 6.
 Problem Analysis  Coding  Debugging  Testing.
Programming what is C++
Lecture 2 Introduction to Programming
Unit# 8: Introduction to Computer Programming
Problem Solving Skill Area 305.1
Lecture 7 Algorithm Design & Implementation. All problems can be solved by employing any one of the following building blocks or their combinations 1.
Presentation transcript:

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson1 Week 1 - Principles of programming Welcome from the Presenters Steve Garner and Dr Ian Coulson

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 2 Essential information [1] zThe module is a means to learn programming principles zQuick Basic is a language to do this- available on most machines which have DOS, Windows or NT zWe assume you know NOTHING about programming a computer

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 3 Essential Information [2] zModule continually assessed 1 workshop exercises weeks 2 to % 2 Assignment 1 week 5- 35% Assignment 2 week % z You must PASS BOTH of these components z 1 hour lecture, 3 hour workshop

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 4 Essential information [3] zYou must attend ALL lectures, workshops and work in study time zTo learn this subject you must actually do the practical work, (like riding a bike)! zYou must have the course book - QBasic 2nd ed. - Bauman and Mandell

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 5 Principles of computing zComputer hardware consists of several fundamental parts - monitor, system and keyboard zA Computer programme is set of instructions that tells the computer what to do. Written in English and interpreted into the computers working language (Binary), and then executed. It is too difficult for humans to work in computer language directly !

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 6 How to tackle a problem zWe will now look at how we will tackle a real problem zwe will go through the steps needed to produce a working program

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 7 Where to start zWhy programme ? All computers require a program in order to work. i.e. Word processing package has been written using a programming language. zFirst… look at the thing we are trying to get the computer to do. i.e. add two numbers zTo produce the program we must follow a series of steps

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 8 The Steps (it’s all down hill) Program Problem Analysis & Design Testing Document Review Solution Start

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 9 Problem - Requirements and Specification zDevelop a full understanding of the problem zCan be difficult to do: Users do not know what they want! Users keep changing their minds! zOnce the problem is understood, a Program Specification can be produced zThis specification will summarise the problem, and act as the agreement of what the developers must produce for the users

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 10 Analysis & Design [1] zOnce we fully understand the problem, then we can attempt to design a solution. zProbably the most important stage of the process as a good design will greatly simplify later steps zWill involve looking at: yInput data and corresponding output data yWhat processing is involved

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 11 Analysis & Design [2] zThere are many design techniques used, we will use what is known as pseudo code ysimply write down the steps in words - known as pseudo code

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 12 Testing zWe must test the design to ensure it gives the correct answers. zBy using sample data and applying the pseudo code steps to it, we can prove the design works.

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 13 Program or Coding zThe design and testing must be complete before this stage zYou should know what you want to achieve before beginning to code it! zIt should now be quite straightforward to implement our designs in code

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 14 Document zIf anyone else needs to look at or run your program it will need DOCUMENTING zWhat the problem is zHow did you design it? zHow did you test it? zWhat sort of data does it use? zWhat does each line of code do? zHow do you run it?

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 15 An example problem zWe wish to design and code a program that will convert a measurement in kilometres to it’s equivalent in miles - write down the steps needed in the program zWe will set the constraint that input of the number of Kilometres will be from the keyboard, and the result displayed in miles on the screen

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 16 Analysis and Design za.Read the Problem zb.Read it again! zc.Do it on paper xtest data xtest algorithms xcheck results zd.Produce Design

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 17 a. Read The Problem za.Read the Specification - Understandable - OK zb.Read it again yIdentify the purpose of program :- To calculate the number of kilometres equivalent to a given number of miles

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 18 c. Do it on Paper zc.Do it on paper yA typical number of kilometres inputted may be 3. ythe answer should be 1.86 miles as 1 mile is equal to 1.61 km

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 19 Output to be displayed (with suitable instructions ): Enter the number of miles : 3 Users input There are 1.86 miles in 3 kilometres Screen output

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 20 Prepare Design [1] zThe first simple design, in pseudo code, would be: y1.enter number of km. y2.Calculate miles. y3.Display the answer. zThese steps can be broken down further

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 21 Prepare Design [2] zNew, more detailed, design: z1.Get number of km y1.1 Prompt user to enter the number of km y1.2 Read in the km from the keyboard z2.Calculate miles y2.1 divide km by number of km in one mile z3.Display the number of miles y3.1 Display number of miles with corresponding message

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 22 The solution - Prepare code REM program : to convert miles to kilometres REM written by : Ian Coulson REM date written: 15/9/98 DIM Km AS SINGLE‘Create variables DIM Miles AS SINGLE CLS‘this will clear the screen PRINT “This program converts km to miles.” ‘ message INPUT “Enter the number of km to be converted; “, km LET Miles = km / 1.61‘calculation PRINT “There are”; Miles; “miles in”; km; “kilometres.” END

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 23 Using Print statements zYour first steps in learning to programme is usually to display a suitable message on the screen zThe keyword PRINT in Qbasic is an instruction to display something on the screen. zHere is the way it works

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 24 Using the print statement zThe Print statement has the format PRINT “This is the text I want displayed on the screen” Use the Print keyword Enclose the text to be displayed in quotation marks This is the text I want displayed on the screen Resulting output on the screen

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 25 Printing on the screen zQbasic divides the screen into 80 columns and 25 rows. 25 rows 80 columns zQbasic has a number of mechanisms to arrange where on the screen you wish to print information zHave a look at the following examples

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 26 Print formatting PRINT “This is the first thing printed ” PRINT “Next thing printed” This is the first thing printed Next thing printed Each print statement causes a new row to be used

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 27 Print formatting - using the ; character PRINT “This is the first thing printed ” ; PRINT “Next thing printed” This is the first thing printedNext thing printed The ; causes the next string to be printed starting in the next column on the same line

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 28 Print formatting using the, character PRINT “This is the first thing printed ”, PRINT “Next thing printed” The, causes the next string to be printed in the next available print zone This is the first thing printed Next thing printed The screen is divided into 5 print zones each 14 columns wide 14 columns

CP1020 University of Wolverhampton - Steve Garner and Ian Coulson 29 Questions 1 Why don’t we program in the computers natural language directly ? 2 Why do we need to go through all the Steps to write a program ? 3 Write the code to display the message Hello World on the screen Return to view another lecture