Visual Basic: An Object Oriented Approach 3 – Making Objects Work.

Slides:



Advertisements
Similar presentations
Driving Test 1 Marking Scheme Focus on five areas to pass driving test 1.
Advertisements

CSM18 Visual Basic Section1 Department of Computing UniS 1 CSM18 Interactive Computing Introduce Visual Basic language - provides excellent facilities.
CSM18 Visual Basic Section 2 Department of Computing UniS 1 CSM18 Further Constructs in VB A statement is the fundamental syntactical element of a program.
CS107 Introduction to Computer Science Lecture 2.
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
Visual Basic: An Object Oriented Approach 6: Object Modelling.
1 Javascrbipt Intro Javascript (or js) is a programming language. Interpreted, not compiled. Not the same as java, but, similar. Use tags to use. Object-oriented.
VBA Modules, Functions, Variables, and Constants
Program Design and Development
Mark Dixon, SoCCE SOFT 131Page 1 04 – Information Processing: Data-types, Variables, Operators & Functions.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
Data types and variables
ACSE th Conference The Iconic Programmer Stephen Chen.
Chapter 8: Introduction to High-level Language Programming Invitation to Computer Science, C++ Version, Third Edition.
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
Mark Dixon, SoCCE SOFT 131Page 1 05 – Information Processing: Data-types, Variables, Operators & Functions.
Adding Automated Functionality to Office Applications.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Python quick start guide
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Visual Basic: An Object Oriented Approach 5: Structured Programming.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
AS Computing Introduction to Programming. What is a Computer Program? A list of instructions that a computer must work through, in a logical sequence,
CHAPTER THREE Representing Data: Constants and Variables.
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
Introduction. 2COMPSCI Computer Science Fundamentals.
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
20-753: Fundamentals of Web Programming 1 Lecture 12: Javascript I Fundamentals of Web Programming Lecture 12: Introduction to Javascript.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
Visual Basic CODE. Basics of Code Declaration Declaration Set aside a named place to put things Set aside a named place to put things Assignment Assignment.
CSCI 3327 Visual Basic Chapter 4: Control Statements in Visual Basic (Part 1B) UTPA – Fall 2011.
Practical Programming COMP153-08S Week 4: Recap, Accessing Files, Menus.
VBScript Language. What is VBScript Based on the Visual Basic family of languages Supports object oriented features Interpreted Loosely Typed Implicitly.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
CS285 Visual Basic 2 Department of Computing UniS 1 Statements in Visual Basic A statement is the fundamental syntactical element of a program smallest.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
1 Scripting Languages VBScript - Recognized mainly by Internet Explorer only - Netscape does have a plug-in JavaScript - Recognized by Internet Explorer.
Other Variable Types Dim lab as String makes a box that can store a label tag Dim ColHead As String ColHead = “function” ColHead function Dim lab as Boolean.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
Computer Game Design ActionScript is… Object-oriented programming Everything you do in ActionScript does something to some object* Some objects.
Algorithm Discovery and Design Objectives: Interpret pseudocode Write pseudocode, using the three types of operations: * sequential (steps in order written)
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 11 So Many Paths … So Little Time.
Object-Oriented Programming: Classes and Objects Chapter 1 1.
CS 31 Discussion, Week 2 Faisal Alquaddoomi, Office Hours: BH 2432, MW 4:30-6:30pm, F 12:30-1:30pm (today)
Selection Using IF THEN ELSE CASE Introducing Loops.
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
CMSC201 Computer Science I for Majors Lecture 05 – Comparison Operators and Boolean (Logical) Operators Prof. Katherine Gibson Based on slides by Shawn.
Chapter 10 Programming Fundamentals with JavaScript
Object-Oriented Programming: Classes and Objects
Object-Oriented Programming: Classes and Objects
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
Chapter 10 Programming Fundamentals with JavaScript
Building Java Programs Chapter 2
Chapter (3) - Looping Questions.
CS285 Introduction - Visual Basic
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.
Intro to Programming Concepts
The Data Element.
Control Structures (Structured Programming) for controlling the procedural aspects of programming CS1110 – Kaminski.
The Data Element.
Using C++ Arithmetic Operators and Control Structures
Presentation transcript:

Visual Basic: An Object Oriented Approach 3 – Making Objects Work

Object Structure An Object has an internal structure that defines its state or identity has an interface through which other objects can work with it

Internal Structure and Operations The state of an object is the set of values of its attributes these are stored in variables, whose value can change over time they can be altered or manipulated by operations, known as program statements

Operators Operators work on values and variables to perform simple arithmetic (+, -, *, / …) string (text) manipulation date manipulation other forms of calculation assignment (=) comparison (=, >, =, <=, Like) Values, variables and operators can be put together (using a form of grammar) to form expressions

Expressions An expression is a combination of values, variables and operators has a value (found by calculating the expression) has a type of value (e.g. number, string, date…) can be a direct replacement for a value of the appropriate type x+2 “Joe” & “ Bloggs” Date + 7 (1 week from today) z * (x + 2) (=z * 3 if x is 1) x+2 “Joe” & “ Bloggs” Date + 7 (1 week from today) z * (x + 2) (=z * 3 if x is 1)

Conditions Conditions are expressions that evaluate to True or False Use conditions to control what happens next in a program select statements to execute repeat certain statements until a condition is True If age >= 18 Then buy beer Else buy soft drink End If If age >= 18 Then buy beer Else buy soft drink End If Do sit driving test Loop Until Result=“Pass” Do sit driving test Loop Until Result=“Pass”

Abstraction To create a computer program, we must create an abstraction Remove all unnecessary details Retain all info necessary to the calculations

Object Orientation In Object-Oriented programs, Objects are abstractions of real-world things We often refer to this a Modelling An object is a model of something we represent in a program The object Interface is how we manipulate it

Statements A statement is the fundamental syntactical element of a program smallest piece of code that the language will accept in its own right A statement can be used to set aside space for data storage (variables) assign a value to a variable perform a calculation and assign its result to a variable execute a previously-defined operation control other statements

Example statements Dim x As Integer, y As Single x = 2 x = x + 4 If x > 3 Then y = Sqr(x) Print y End If Declares variables Assigns a value to the variable Assigns the result of an expression Controls other statements Executes a pre- defined operation

Statements in Objects Operations in objects are sequences of statements Can change the state of the object by changing the value of one or more variables Can retrieve data from the object Could do both In general A Sub is a sequence of statements that does something to the state of an object A Function is a sequence of statements that retrieves a value based on the values of the object’s member variables A Property is a set of statements that reflect an attribute of the object, allowing it to be read or changed Sometimes, these distinctions can become blurred

Inter-object communication One object (the Client) makes use of another object (the Server) by sending it a message The message is a statement within one of the Client’s methods (operations). Account.Deposit (Account)(ATM) Deposit (100.00) This statement is an operation in the ATM object