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

Slides:



Advertisements
Similar presentations
The Web Warrior Guide to Web Design Technologies
Advertisements

IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
VBA Modules, Functions, Variables, and Constants
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
Visual Basic: An Object Oriented Approach 3 – Making Objects Work.
CIS101 Introduction to Computing Week 12 Spring 2004.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
JavaScript Form Validation
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Chapter 4: The Selection Structure
CHAPTER SIX Reducing Program Complexity General Sub Procedures and Developer-defined Functions.
Event Handlers CS101 Introduction to Computing. Learning Goals Learn about event handlers Determine how events are useful in JavaScript Discover where.
Microsoft Visual Basic 2008 CHAPTER 8 Using Procedures and Exception Handling.
Rote Learning of the Week "A variable is a named section of RAM that stores data of a specific data type"
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Variables "There are 10 kinds of people in the world today – those who understand binary and those who don't!” Unknown.
CS0004: Introduction to Programming Variables – Strings.
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.
Tutorial 8 Programming with ActionScript 3.0. XP Objectives Review the basics of ActionScript programming Compare ActionScript 2.0 and ActionScript 3.0.
Using Client-Side Scripts to Enhance Web Applications 1.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Computer Programming 2 Lab(1) I.Fatimah Alzahrani.
Fundamentals of GUI Programming. Objectives: At the end of the session, you should be able to: describe the guidelines that are used for creating user-friendly.
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
Applications Development
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
What is Programming? Computer programming is about telling the computer what it is we want it to do We tell the computer what we want it to do by sending.
1 CS105 Discussion 5 – Variables and If Announcements MP 1 due on Monday Midterm 1 on Tuesday If you need a conflict, request it NOW!!
Lecture 2 Conditional Statement. chcslonline.org Conditional Statements in PHP Conditional Statements are used for decision making. Different actions.
CS100A, Fall 1998 Key Concepts 1 These notes contain short definitions of the basic entities that make up a Java program, along with a description of the.
CSD 340 (Blum)1 Starting JavaScript Homage to the Homage to the Square.
1 Chapter 4 – Decisions 4.1 Relational and Logical Operators (see other set of slides) 4.2 If Blocks (see other set of slides) 4.3 Select Case Blocks (see.
31/01/ Selection If selection construct.
Introduction Chapter 1 1/22/16. Check zyBooks Completion Click on the boxes for each section.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Visual Basic 6 Programming Decide how many variables you need by looking at this form. There is one textbox for input and there are 3 labels for output,
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Week 6. Things you should know by now 1. Stop calling me “sir” 2. If you need to go to the loo in the lab you don’t need to ask 3. There are a few other.
 ASP.NET provides an event based programming model that simplifies web programming  All GUI applications are incomplete without enabling actions  These.
JavaScript 101 Lesson 6: Introduction to Functions.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
© 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.
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.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
A little PHP. Enter the simple HTML code seen below.
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.
Lecture 7 Methods (functions and subroutines) Parameter Passing
A variable is a name for a value stored in memory.
Variables Data Types and Assignment
Microsoft Access Illustrated
Using Procedures and Exception Handling
PL/SQL Scripting in Oracle:
Chapter 6 Sub Procedures
Tutorial 12 – Security Panel Application Introducing the Select Case Multiple-Selection Statement Outline Test-Driving the Security Panel Application.
Department Array in Visual Basic
Use proper case (ie Caps for the beginnings of words)
Integrating JavaScript and HTML
CIS16 Application Development and Programming using Visual Basic.net
List Based Objects.
Statements and expressions - java
CS285 Introduction - Visual Basic
Additional Topics in VB.NET
List Based Objects.
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Variables Data Types and Assignment
Tutorial 10: Programming with javascript
List Based Objects.
Variables Data Types and Assignment
Presentation transcript:

Driving Test 1 Marking Scheme Focus on five areas to pass driving test 1

1. Documentation & Organisation Comments Block and In-Line Meaningful names for variables and other objects Use of naming conventions for controls e.g. txt lbl etc.. Split our system into layers

2. Events and Handlers The user triggers an event e.g. click The handler contains some code that does something when that event happens Code executes in sequence from line 1 to line n

3. Objects Allow us to control the computer without worrying about the complexity under the lid Objects are defined by classes (Cake v Recipe) Objects have methods that make them do something DeleteQuery.Execute("qry_tblAddress_Delete") Objects have properties that tell us/set something txtAddressNo.Text

4. Variables & Assignment Simple object that controls the RAM Declare a variable using Dim (make a box in RAM) Dim FirstName as String Give the box a name so we may put data in it Give the box a data type so we may control what kind of data it may store Use the assignment operator = to copy data into the box FirstName = txtFirstName.Text

5. Functions and Parameters Functions perform a predefined task and return a value Parameters (like the assignment operator) are another way of copying data from one part of the system to another We will look at IsNumeric in this lecture Functions are useful for telling us something about the state of the system (has the user entered a valid date?) Use them in an If statement to validate data and provide error messages to the user

Sequence v Selection Sequence describes the code executing line by line Selection is about making decisions Selecting one block of code Or Selecting a different block of code Handled by If Statements

The If Statement If condition Then ‘execute the code here End If

Else

Conditions Relational operators >If a > b Then <If a < b Then >=If a >= b Then <=If a <= b Then Equality and Inequality operators =If a = b Then <>If a<>b Then

When is an Assignment Operator not an Assignment Operator? All about context “The jelly is nearly set.” And “The badger returns to its set.”

ElseIf

If Statements in Action We shall look at the code for GPE

Validation "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.“ Rich Cook

Validation Create software that is Robust (doesn’t crash) Responsive (Tells us what went wrong) Consider the following code Dim FirstName as Integer FirstName=”Fred”

What is wrong with the following? Dim Age as Integer Age = txtAge.Text

IsNumeric ‘declare a variable to store the age Dim Age as Integer ‘test the data typed in the text box to see if it is a number If IsNumeric(txtAge.Text)=True Then ‘if it is ok read in the value Age = txtAge.Text Else ‘if not ok then show an error lblError.Text = "The age is not valid" End If

Note The next set of examples won’t be needed until driving test 3 (after Christmas) Look at the code and start to get an understanding of what it does Don’t worry if it makes no sense at first we will come back to this later on in the module

IsDate ‘declare a variable to store the date of birth Dim DOB as Date ‘test the data typed in the text box to see if it is a date If IsDate(txtDOB.Text)=True Then ‘if it is ok read in the value DOB = txtDOB.Text Else ‘if not ok then show an error lblError.Text = "The date of birth is not a valid date" End If

Testing for a blank field (=“”) ‘declare a variable to store first name Dim FirstName as String ‘test the data typed in the text box to see if it isn’t blank If txtFirstName.Text<>"" Then ‘if it is ok read in the value FirstName = txtFirstName.Text Else ‘if not ok then show an error lblError.Text = "You must enter your first name." End If

Testing Number of Characters (Len) ‘declare a variable to store first name Dim FirstName as String ‘test the data typed in the text box is not over 20 characters If Len(txtFirstName.Text)<=20 Then ‘if it is ok read in the value FirstName = txtFirstName.Text Else ‘if not ok then show an error lblError.Text = "First name must not exceed 20 letters." End If

Validating an Address (InStr) ‘declare a variable to store the address Dim as String ‘test the data typed in the text box has symbol If InStr(txt .Text, >0 Then ‘if it is ok read in the value = txt .Text Else ‘if not ok then show an error lblError.Text = "Not a valid address." End If Question – What is the problem with the above code?

The problem is… that the following are all valid addresses.. @

An Address Must Have… symbol “. ” symbol e.g. hotmail.com At least 5 characters (?)

(What is wrong with the following if we use ?) Dim as String ‘test the data typed in the text box has symbol If InStr(txt .Text, >0 Then = txt .Text Else lblError.Text = "Not a valid address." End If ‘test the address is long enough If Len(txt .Text) >5 Then = txt .Text Else lblError.Text = "The address is too short." End If ‘test the data typed in the text box has an. symbol If InStr(txt .Text, ".") >0 Then = txt .Text Else lblError.Text = "Not a valid address." End If

Better??? ‘declare a variable to store the address Dim as String ‘test the data typed in the text box has symbol If InStr(txt .Text, >0 Then ‘test the address is long enough If Len(txt .Text) >5 Then ‘test the data typed in the text box has an. symbol If InStr(txt .Text, ".") >0 Then ‘if it is ok read in the value = txt .Text Else lblError.Text = "Not a valid address." End If Else lblError.Text = "The address is too short." End If Else lblError.Text = "Not a valid address symbol." End If

Or…. ‘declare a variable to store the address Dim as String ‘clear the error message label lblError.Text = "" ‘test the data typed in the text box has symbol If InStr(txt .Text, = 0 Then lblError.Text = symbol." End If ‘test the address is long enough If Len(txt .Text) <=5 Then lblError.Text = lblError.Text & " The address is too short." End If ‘test the data typed in the text box has a. symbol If InStr(txt .Text, ".") = 0 Then lblError.Text = lblError.Text & "No dot." End If If lblError.Text = "" Then = txt .Text End IF

Validation Function Examples Assuming we have two variables… Dim OK as Boolean Dim SomeValue as Integer What values would be assigned in the following?... OK = IsNumeric(“Hello”) OK = IsDate(“1 Feb 2012”) SomeValue = Len(“Help!”) SomeValue =