Developing Software Applications Introduction to Programming Fundamentals Scoping in VB Simple Ifs in VB.

Slides:



Advertisements
Similar presentations
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Advertisements

Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 4 – Introducing Algorithms, Pseudocode and.
Program Design and Development
Developing Software Applications Introduction to Variables & Data Types in VB State Transition Diagrams.
Computer Science 1620 Programming & Problem Solving.
Introduction to Computers and Programming Class 6 Introduction to C Professor Avi Rosenfeld.
Chapter 1 Program Design
VB Code Statements 3 types of VB statement The Remark statement, known as comments, are used for project documentation only Begin with an apostrophe Not.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
Chapter Three Using Variables and Constants Programming with Microsoft Visual Basic th Edition.
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
Visual Basic Fundamental Concepts. Integrated Development Enviroment Generates startup form for new project on which to place controls. Features toolbox.
06/10/ Working with Data. 206/10/2015 Learning Objectives Explain the circumstances when the following might be useful: Disabling buttons and.
National Diploma Unit 4 Introduction to Software Development Data types, variables and constants.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Introduction to Scheme Lectures on The Scheme Programming Language, 2 nd Ed. R. Kent Dybvig.
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.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
CS285 Visual Basic 2 Department of Computing UniS 1 Statements in Visual Basic A statement is the fundamental syntactical element of a program smallest.
Visual Basic Programming
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 3 Variables, Constants, Methods, and Calculations.
Programming, an introduction to Pascal
22/11/ Selection If selection construct.
I Power Higher Computing Software Development High Level Language Constructs.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
CS 101 Test 2 Study Guide Acronyms RAD - Rapid Application Development IDE - Integrated Development Environment GUI - Graphical User Interface VB - Visual.
Chapter 3 w Variables, constants, and calculations DIM statements - declaration temporary memory locations identifier, data type, scope data types - values.
Chapter 4 Variables and constants. 4.1 Variables -Use of variables is good programming style -easier to modify -easier for a programmer to understand.
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.1.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Pay Example (PFirst98) Please use speaker notes for additional information!
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
Programming with Microsoft Visual Basic th Edition
Introduction to Files in VB Chapter 9.1, 9.3. Overview u Data Files  random access  sequential u Working with sequential files  open, read, write,
CECS 5020 Computers in Education Visual Basic Variables and Constants.
31/01/ Selection If selection construct.
Fundamental Programming Fundamental Programming More Expressions and Data Types.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
BACS 287 Programming Fundamentals 5. BACS 287 Programming Fundamentals This lecture introduces the following topics: – Procedures Built-in Functions User-defined.
Chapter 3 AS3 Programming. Introduction Algorithms + data structure =programs Why this formula relevant to application programs created in flash? The.
Controlling Program Flow with Decision Structures.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Visual Basic Fundamental Concepts
A variable is a name for a value stored in memory.
VBA - Excel VBA is Visual Basic for Applications
Visual Basic 6 (VB6) Data Types, And Operators
VISUAL BASIC.
Chapter 3: Introduction to Problem Solving and Control Statements
Structured Program
Visual Basic Programming Chapter Four Notes Working with Variables, Constants, Data Types, and Expressions GROUPBOX CONTROL The _____________________________________.
CIS16 Application Development Programming with Visual Basic
1) C program development 2) Selection structure
If selection construct
Chapter 2- Visual Basic Schneider
If selection construct
CS285 Introduction - Visual Basic
Introduction to Problem Solving and Control Statements
Data Types List Box Combo Box Checkbox Option Box Visual Basic 6.0
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
4d – Program Design Lingma Acheson CSCI N331 VB .NET Programming
Presentation transcript:

Developing Software Applications Introduction to Programming Fundamentals Scoping in VB Simple Ifs in VB

VB Applications An application is simply a program A program is a collection of instructions (statements) that tell the computer what to do. A program is called software Hence, program, software and instructions are synonymous. A program is written in a programming language and is converted into the computer's machine code.

Program Introduction All programs have basic requirements They must allow users to interface with system. - INPUT / OUTPUT They must cater for the temporary storage of data in memory whilst the program is running – DATA STRUCTURES They must use the principles of computer logic to process the underlying data – CONTROL STRUCTURES

Designing applications methodically Don’t just start a program immediately, you must do thorough planning before ANY programming is written Take a structured approach Try and adhere to a software development life- cycle

In Visual Basic … VB allows the programmer to design I/O from the potential users perspective VB uses a Graphic User Interface (GUI) Logical processes are distributed to events which can be identified concurrently

Understanding the problem You must first develop a full understanding of the problem This is difficult to do: - Users do not know what they want! - Often ‘speak a different language’ - Change their minds!

Specifying the problem When problem is understood, then a program specification can be produced to embody what is required The problem may require several operations which need to be separate functions of the system Each operation may require a separate view (in VB, a new Form)

Pat sName Short review from last week ….

Naming conventions iTotalIntegere.g 387 fAverageFloating Pointe.g cSalaryCurrencye.g £4.28 sNameStringe.g Pat

More on data types – numerical which one to use ? Integer Long Single Double Currency

String Text Fixed or variable length Fixed - from 0 to 65,500 characters in length Variable – up to 2 billion characters If the average length of a word is 7 characters this equates to …..

Boolean data type Boolean True or false represented by some systems as 1 or 0 Can be used as a “Yes or No” option check box - “the task has been done” Useful function but may not transfer to other languages

Scoping How does how (& where) I declare a variable e.g Diminside an event Private at the top of a form Public in a module affect the scope of where that variable may be used ?

What code might need to use the data? Just in one event Just in one form In several forms

Dim, Private or Public ? Just in one event use Dim at start of that event this is called local data In more than one event but just in one form use Private after Option Explicit at top of code for that form this is called form level data

In more than one form Use Public Code in a Module This is called Global or Code level data Summarising : In 1 eventDim In 1 FormPrivate In several formsPublic

Declaring Global variables Select Project | Add Module Code examples : Public sTeamName As String Public iNoOfMembers As Integer Public Const BasicHandicap = 21

Projects with more than 1 form Etc ~

A State Transition Diagram ~ helps us to plan how the project will flow between different forms (or ‘states’) Add / Subtract form Mult / Square form Enter Name form Menu form Continue Start Exit Add or Subtract Return to Menu Mult or Square Return to Menu

Dealing with choices : simple IF statements In English: If exam mark greater than 40 Then set grade to Pass Coding: If iMark > 40 Then sGrade = “Pass” End If

If …… Then ….. Else ….. If …………………. Then …………. Else …………. End If

Example : If iMark > 40 Then sGrade = “Pass” Else sGrade = “Fail” End If

Nested IFs If iMark > 60 Then sGrade = “Merit” Else If iMark > 40 Then sGrade = “Pass” Else sGrade = “Fail” End If

Planning this out in Structured English / Pseudocode Input exam mark IF exam mark > 60 THEN set grade to Merit ELSE IF exam mark > 60 THEN set grade to Pass ELSE set grade to Fail END IF Output grade