Program Organization Sequential Execution: One line done after the other Conditional Execution: If a test is true, one section is done, otherwise another.

Slides:



Advertisements
Similar presentations
CS0004: Introduction to Programming Repetition – Do Loops.
Advertisements

Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
©2004 Brooks/Cole Chapter 2 Variables, Values and Operations.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 3 Programming - Putting Together the Pieces.
SUNY Morrisville-Norwich Campus-Week 12 CITA 130 Advanced Computer Applications II Spring 2005 Prof. Tom Smith.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
CS241 PASCAL I - Control Structures1 PASCAL I - Control Structures Philip Fees CS241.
Chapter 1 Program Design
Adding Automated Functionality to Office Applications.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
Python quick start guide
Programming Logic Program Design. Objectives Steps in program development Algorithms and Pseudocode Data Activity: Alice program.
 Value, Variable and Data Type  Type Conversion  Arithmetic Expression Evaluation  Scope of variable.
CIS Computer Programming Logic
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Recursion Review.
Flow of Control. 2 Control Structures Control structure: An instruction that determines the order in which other instructions in a program are executed.
DEPARTMENT OF COMPUTER SCIENCE & TECHNOLOGY FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UWA WELLASSA 1 CST 221 OBJECT ORIENTED PROGRAMMING(OOP) ( 2 CREDITS.
Object Oriented Design: Identifying Objects
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
08/10/ Iteration Loops For … To … Next. 208/10/2015 Learning Objectives Define a program loop. State when a loop will end. State when the For.
Chapter 06 (Part I) Functions and an Introduction to Recursion.
Chapter 1 Object Orientation: Objects and Classes.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 1B) UTPA – Fall 2011.
Games Development 2 Concurrent Programming CO3301 Week 9.
Keeping it Neat: Functions and JavaScript Source Files Chapter 7.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Prepared by: Elsy Torres Shajida Berry Siobhan Westby.
Pseudocode Simple Program Design Third Edition A Step-by-Step Approach 2.
Procedural programming in Java Methods, parameters and return values.
Higher Grade Computing Studies 3. High Level Language Constructs Higher Computing Software Development S. McCrossan 1 Simple Data Types Integer: An integer.
CMP-MX21: Lecture 4 Selections Steve Hordley. Overview 1. The if-else selection in JAVA 2. More useful JAVA operators 4. Other selection constructs in.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
Introduction to Java Java Translation Program Structure
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
I Power Higher Computing Software Development High Level Language Constructs.
CSCI 1100/1202 April 1-3, Program Development The creation of software involves four basic activities: –establishing the requirements –creating.
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
CS241 PASCAL I - Control Structures1 PASCAL Control Structures Modified Slides of Philip Fees.
Arithmetic, Class Variables and Class Methods Week 11
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Functions, Loops, and Parameters.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
Multiple Items in one Data Object Arrays are a way to store more than one piece of data in a data object, provided that all the data is of the same type.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
What About Alice? In Alice, we have seen that we have:  Objects (skater, snowman, snowwoman, camera)  Methods (move, turn, roll, move toward)  Properties.
CSCI 3328 Object Oriented Programming in C# Chapter 4: C# Control Statement – Part I – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
CSCI 51 Introduction to Programming Dr. Joshua Stough February 24, 2009.
© 2004 Pearson Addison-Wesley. All rights reserved January 23, 2006 Creating Objects & String Class ComS 207: Programming I (in Java) Iowa State University,
A Sample Program #include using namespace std; int main(void) { cout
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Objects Allow us to represent and control the computer technology Use methods to make the object do something Use properties to find out and change the.
Unit 2 Technology Systems
Object Oriented Programming
Single Table Queries in SQL
Variables Data Types and Assignment
Microsoft Access Illustrated
File Handling Programming Guides.
Lecture 15 (Notes by P. N. Hilfinger and R. Bodik)
Objectives After studying this chapter, you should be able to:
T. Jumana Abu Shmais – AOU - Riyadh
Introduction to Problem Solving and Control Statements
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Flow of Control.
Variables Data Types and Assignment
Classes / Objects / Methods
Looping and Multiple Forms TEST REVIEW
Variables and Computer Memory
Variables Data Types and Assignment
Presentation transcript:

Program Organization Sequential Execution: One line done after the other Conditional Execution: If a test is true, one section is done, otherwise another section is done Repetition: Do a section repeatedly, either a fixed number of times, or until a condition occurs Parallel Execution: Do the lines at the same time

Subprograms Often a section of a program is done repeatedly, but in different parts of the program. Such a section can be made a subprogram, which is written once, but called many times. Even when a section of code is called just once, it may be useful to make it a subprogram, because conceptually, it is one whole thing. This is useful in larger programs.

Advantages of Subprograms Coding, debugging, and modifying a subprogram is easier, because there's only one copy of the code and it's all in the same place. It's easier for humans to understand programs that are broken down into well-designed pieces. The code may be have values that change from call to call, and thus may operate using different values. Code can be written by different people.

Objects In Object-Oriented design, the programming task is broken down in to various objects. Each object has its own set of properties, e.g., color, position, height, and methods, e.g., moveTo, faceTowards, which can be thought of as actions. Objects can interact with one another.

Classes A class is a blueprint for a set of objects. The class specifies what the properties are for the object and what the methods (actions) are. The actual value of the properties for a particular object differ from object to object, but all objects of the same class have the same set of properties and methods.

Instance An object of a particular class is called an instance of that class. For example, the Dragon class may specify all the methods of properties that Dragons may have, while bobTheDragon may be a particular Dragon with a particular set of values for its properties. maryTheDragon could be a different Dragon, with a different set of properties. They would employ the same methods however.

Example The Dragon class may specify that Dragons have color, position, and size. JoeTheDragon might be green, be flying at position (10,10), and be of size 2, while bettyTheDragon might be red, standing at position (0,0), and be of size 5. All Dragons would share the same methods.

Parts Objects can be parts of other objects, e.g., a snowman may have arms, legs, and a head. The head may have a hat. Each sub-part may have its own properties and methods.

Functions Functions are special subprograms that return a value. Functions can be used to return property information about an object, do arithmetic calculations, or even tell how things are related. Examples: snowman1.size(), x.plus(3), snowman1.size().lessThan(5).

State At any point in time, a program is in a particular state. The state represents where all the objects are, and what the values of their properties are, as well, as perhaps some global information. As the program progresses, the information stored in the state changes.

Variables In many programming languages (without objects), values are stored just in variables. In object-oriented languages, the properties of objects can be though of variables which are attached to the object. Variables can be simple or compound. A simple variable contains one value. A compound variable can contain multiple values, but they must be organized in some fashion.

Variables (cont'd) You can think of a simple variable as a box, which can hold one thing, and only one thing. You can change the contents of the box, or retrieve the contents of the box. In many programming languages, a variable can only hold one specific kind of thing. For example, a hat box, can only contain hats, and a shoebox can only contain shoes.

Types The kind of things that a variable can hold is called a type. Examples of types are (in C++) are ints (which are whole number values, or integers), double (which represent real values), bool (for Boolean, which are values that are either true or false). C++ variables can also be used to hold strings (which are text). In Alice, four common types are: number, Boolean value, string, and object.

Identifiers Variables also have names, which are how humans know which variable is which. Names of variables are a type of identifier. Other things, such as subprograms, functions, methods, and objects also have names which are identifiers. Each programming language has rules about forming valid identifiers.