I Power Higher Computing Software Development High Level Language Constructs.

Slides:



Advertisements
Similar presentations
compilers and interpreters
Advertisements

Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Chapter 41 Variables and JSP Control Structures JavaServer Pages By Xue Bai.
Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC Lecture two Dr. Hamdy M. Mousa.
VBA Modules, Functions, Variables, and Constants
Program Design and Development
Chapter 4 Loops and Character Manipulation Dr. Ali Can Takinacı İstanbul Technical University Faculty of Naval Architecture and Ocean Engineering İstanbul.
Statement-Level Control Structures Sections 1-4
An Object-Oriented Approach to Programming Logic and Design Chapter 7 Arrays.
Chapter 1 Program Design
Lilian Blot CORE ELEMENTS COLLECTIONS & REPETITION Lecture 4 Autumn 2014 TPOP 1.
Java Unit 9: Arrays Declaring and Processing Arrays.
Python quick start guide
High Level Programming Language Constructs Higher Computing Unit 2 – Software Development.
Imperative Programming Part One. 2 Overview Outline the characteristics of imperative languages Discuss other features of imperative languages that are.
Simple Program Design Third Edition A Step-by-Step Approach
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
Lecture Set 5 Control Structures Part D - Repetition with Loops.
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Chapter 4: Decision Making with Control Structures and Statements JavaScript - Introductory.
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
Procedures and Functions Computing Module 1. What is modular programming? Most programs written for companies will have thousands of lines of code. Most.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
I Power Int 2 Computing Software Development High Level Language Constructs.
CPS120: Introduction to Computer Science Decision Making in Programs.
Control Structures By Shyam Gurram. Control Structure In this chapter we have two different types of structures. Conditional Structure Iterative Control.
JavaScript Syntax and Semantics. Slide 2 Lecture Overview Core JavaScript Syntax (I will not review every nuance of the language)
sequence of execution of high-level statements
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
Saeed Ghanbartehrani Summer 2015 Lecture Notes #5: Programming Structures IE 212: Computational Methods for Industrial Engineering.
Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Control Structures sequence of execution of high-level statements.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
Chapter 15 JavaScript: Part III The Web Warrior Guide to Web Design Technologies.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Controlling Computers with Programs When you create a computer program you are creating a set of instructions that tell the computer exactly and completely.
Controlling Program Flow with Decision Structures.
W E E K F I V E Control Flow. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 8 Topics Introduction Selection Statements Iterative Statements.
Why Repetition? Read 8 real numbers and compute their average REAL X1, X2, X3, X4, X5, X6, X7, X8 REAL SUM, AVG READ *, X1, X2, X3, X4, X5, X6, X7, X8.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
National Diploma Unit 4 Introduction to Software Development Procedures and Functions.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
CIS199 Test Review 2 REACH.
Unit 2 Technology Systems
Information and Computer Sciences University of Hawaii, Manoa
Chapter 3: Decisions and Loops
Visual Basic 6 (VB6) Data Types, And Operators
GC211Data Structure Lecture2 Sara Alhajjam.
Programming Mehdi Bukhari.
Scripts & Functions Scripts and functions are contained in .m-files
Data Structures Recursion CIS265/506: Chapter 06 - Recursion.
Agenda Control Flow Statements Purpose test statement
Arrays, For loop While loop Do while loop
Chapter 10 Programming Fundamentals with JavaScript
Arithmetic operations, decisions and looping
Coding Concepts (Basics)
` Structured Programming & Flowchart
Variables In today’s lesson we will look at: what a variable is
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Chapter 2 Programming Basics.
The structure of programming
Basic Programming Concepts
The structure of programming
Thinking procedurally
REPETITION Why Repetition?
Presentation transcript:

I Power Higher Computing Software Development High Level Language Constructs

What we will learn Simple Data types Arrays Decision Making Modules and Parameter Passing

Simple Data Types Some of the types of variables used include: String Real Integer Boolean

Strings String variables contain text and can take up a range of memory. Two operations that can be applied are: Concatenation. Substrings.

Concatenation Concatenation is the addition of two strings. One string is placed at the end of the other. Forename$ = “Bob” Surname$= “Jones” Fullname$ = Forename$ + Surname$ The Variable Fullname$ will now contain: “BobJones”

Substrings Substrings are often referred to as string slicing. This is where the part of the string is extracted. A Variable Fullname$ may contain: “BobJones” Forename$ := Fullname$(1:3) Surname$ := Fullname$(4:8) Forename$ now contains “Bob” and Surname$ now contains “Jones”

Real Real numbers are floating point numbers. They usually use 32 bits of computer memory in a single memory location. Remember: E.g = x 100 = x10 2 Any number can be represented in the form: M x base e Where M is the mantissa and e is the exponent.

Integer An Integer is any positive or negative whole number. Integers usually use 32bits of computer memory. All mathematical operations can be applied to these numbers. E.g. + - x /

Boolean A Boolean value can have either the value True or False. Their value is stored using one bit of memory. Logical operators can be used on Booleans E.g. AND, OR, NOT.

Arrays This is a set of data items of the same type grouped together with a single variable name. Each Data item (Element) in the array is identified by the variable name and a subscript (index). An array of names may look like this: Name(1) Contains John Name(2) Contains Helen Name(2) Contains Peter

Decision Making All languages have some decision-making construct. IF, where the execution of an action depends on a stated condition. Most languages expand this to allow for a series of outcomes using: IF…THEN…ELSE…

Decision Making (Cont.) The IF…THEN…ELSE… construct can be replaced with a CASE (SWITCH) statement. The CASE statement is no different once translated to machine code. The advantage is that it is clearer to read and understand.

Decision Making (Cont.) Nested IF IF mark >= 70 then PRINT “A” ELSE IF mark >= 60 then PRINT “B” ELSE IF mark >= 50 then PRINT “C” ELSE IF mark >= 45 then PRINT “D” ELSE PRINT “No Award” END IF CASE Statement CASE mark OF >= 70: Print “A” >= 60: Print “B” >= 50: Print “C” >= 45: Print “D” DEFAULT : Print “No Award” END CASE

Fixed Loops A For loop can be used to execute one or more commands a known amount of times. For counter = 1 to total execute this command Next

Conditional Loops A Conditional Loop can be used when the programmer does not know how many times the code will have to be repeated. The test to loop again can be done at the start or at the end.

Conditional Loops Do Execute this command Loop Until exit = TRUE Do While exit = FALSE Execute this command Loop

Modules Well written code is often broken down into several modules This allows different programmers to each write a separate part of the solution. This also means that should you wish to change part of your code during the maintenance phase, the affected part can be lifted out and replaced without affecting the rest of the code.

Modules (Cont.) Modules can take many different form depending on the language. The two main modules we need to know about are: Subroutines (Procedures); This is a section of code designed to do a specific task. They are then called during the running of the code. Functions; This is similar to a subroutine except that it has a value that can be assigned rather than returning a variable.

Scope The parts of the program that can see and use the variable are called the scope of the variable. Local variables exist only within a single module and cannot be accessed from elsewhere in the code. Global variables are created in the main part of the program and can be seen from any part of the program.

Parameter passing by value (In Parameter) When a parameter is passed by value into a subroutine an exact copy of current value of the original variable is used by the subroutine. This allows one-way data transfer between the main program and the subroutine. The programmer can then guarantee that the variable will still be suitable for other parts of the code.

Passing by value (Example) The Value of the parameter stored at location 5000 is passed by value. Memory Locations A copy of the value is stored at location 5001 Simon The subroutine is then free to change the value in 5001 The value of the original remains unchanged. Simon Paul

Parameter Passing by Reference (In/Out Parameter) Parameter passing by reference allows the data that is passed into a subroutine to be changed, then passed back out to other parts of the program. This allows a two way data transfer between the main program and the subroutine.