Learning Intention I will learn about the standard algorithm for input validation.

Slides:



Advertisements
Similar presentations
Looping while … do …. Condition Process 2 Process 1 Y Repeated Loop.
Advertisements

1 Software Engineering Lecture 11 Software Testing.
Designing Algorithms Csci 107 Lecture 3. Designing algorithms Last time –Pseudocode –Algorithm: computing the sum 1+2+…+n –Gauss formula for 1+2+…+n Today.
1 Lab Session-6 CSIT-121 Spring 2005 Structured Choice The do~While Loop Lab Exercises.
1 Lab Session-7 CSIT-121 Fall Introducing Structured Choice 4 The do~While Loop 4 Lab Exercises.
Systems Life Cycle A summary of what needs to be done.
CC0002NI – Computer Programming Computer Programming Er. Saroj Sharan Regmi Week 7.
Repetition Statements Repeating an Action A specified number of times While a Condition is True Until a Condition is True.
THE BIG PICTURE. How does JavaScript interact with the browser?
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Designing While Loops CSIS 1595: Fundamentals of Programming and Problem Solving 1.
Errors!. Where do errors occur? Anywhere data is transferred, processed, stored, etc. Input user error Storage magnetic hard drive errors physical tampering.
2016 N5 Prelim Revision. HTML Absolute/Relative addressing in HTML.
Intro to Loops 1.General Knowledge 2.Two Types of Loops 3.The WHILE loop 1.
Tuesday, 16 February 2016 Integers. Tuesday, 16 February 2016 Learning Intention Success Criteria 2.Solving expressions showing working. 1.To explain.
Comments, Conditional Statements Continued, and Loops Engineering 1D04, Teaching Session 4.
CPSC 233 Tutorial 5 February 2 th /3 th, Java Loop Statements A portion of a program that repeats a statement or a group of statements is called.
Controlling Program Structures. Big Picture We are learning how to use structures to control the flow of our programs Last week we looked at If statements.
CHAPTER #7 Problem Solving with Loop. Overview Loop logical structure Incrementing Accumulating WHILE/WHILE-END FOR Nested loop Pointer Algorithmic instruction.
Marr CollegeHigher Software DevelopmentSlide 1 Higher Computing Software Development Topic 4: Standard Algorithms.
1 Project 12: Cars from File. This is an extension of Project 11, Car Class You may use the posted solution for Project 11 as a starting point for this.
Lesson #5 Repetition and Loops.
Whatcha doin'? Aims: To start using Python. To understand loops.
3.1 Fundamentals of algorithms
Learning outcomes 2 Developing Code – Input Output Model
COMPUTATIONAL CONSTRUCTS
while Repetition Structure
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
Lesson #5 Repetition and Loops.
The Software Development Cycle
Teaching design techniques to design efficient solutions to problems
Learning Intention I will learn about the iterative software development process with a focus on the Design stage.
Starter Question In your jotter write the pseudocode to take in two numbers, add them together then display the answer. Declare variables RECEIVE firstNumber.
Programming Constructs Notes
Control Structure Senior Lecturer
When I want to execute the subroutine I just give the command Write()
Standard Algorithms Input validation Finding the minimum
Lesson #5 Repetition and Loops.
Designing an Algorithm
Algorithms & Pseudocode
More Loops.
More Loops.
Scratch: selection / branching/ if / If…else / compound conditionals / error trapping by Mr. Clausen.
Part 11 Q51 to Q55 of National 5 Prelim
Topic 1: Problem Solving
Coding Concepts (Basics)
DO NOW – Decompose a Problem
Introduction to Algorithms and Programming
Learning Intention I will learn about evaluating a program.
Learning Intention I will learn about programming using selection (making choices) with one condition.
Software Development Process
No Yes START Do you live in Scotland? Take umbrella See last Flowchart
CPS125 Week
Learning Intention I will learn about testing programs.
Automated test.
Part 6 Q26 to Q30 of National 5 Prelim
Learning Intention I will learn about concatenation and arithmetic operators.
Learning Intention I will learn how to use an array to store data in a program.
Lesson #5 Repetition and Loops.
Learning Intention I will learn about selection with multiple conditions.
Learning Intention I will learn about the different types of programming errors.
True / False Variables.
CS Problem Solving and Object Oriented Programming Spring 2019
Automated test.
CHAPTER 6 Testing and Debugging.
GCSE Computing.
Python Creating a calculator.
Presentation transcript:

Learning Intention I will learn about the standard algorithm for input validation.

Analysis Design Implementation Testing Documentation Evaluation

Standard Algorithms An algorithm is a step-by-step procedure for solving a problem in a finite number of steps. Any bit of written code that carries out a specific task could be said to be an algorithm.

A program to add two test marks together is to be created A program to add two test marks together is to be created. Both tests are marked out of 20. Normal Test Data: Extreme Test Data: Exceptional Test Data: 1 -> 19 0, 20 -1, 21

A program to add two test marks together is to be created A program to add two test marks together is to be created. Both tests are marked out of 20.

Standard Algorithm - Input Validation Input validation is used to check that input to the program is acceptable. Validating input is a specific task that is used in lots of programs so it is called a standard algorithm.

Input Validation Example A program to enter a users age: SEND “Enter an age (range 0 - 130)” TO DISPLAY RECEIVE age FROM (INTEGER) KEYBOARD SEND “You are “ & age & “ years old” TO DISPLAY

Input Validation – Example 1 SEND “Enter an age (range 0 - 130)” TO DISPLAY RECEIVE age FROM (INTEGER) KEYBOARD WHILE age ˂ 0 OR age ˃ 130 DO SEND “Invalid. Try again” TO DISPLAY END WHILE SEND “You are “ & age & “ years old” TO DISPLAY

Input Validation – Example 2 REPEAT SEND “Enter an age (range 0 - 130)” TO DISPLAY RECEIVE age FROM (INTEGER) KEYBOARD IF age < 0 OR age > 130 THEN SEND “Invalid. Try again” TO DISPLAY END IF UNTIL age >= 0 AND age <= 130 SEND “You are “ & age & “ years old” TO DISPLAY

Standard Algorithm - Input Validation Input validation can be added to any program that is accepting input, even inside another loop (fixed or conditional).

What did this program do? SET total TO 0 REPEAT RECEIVE number FROM KEYBOARD SET total TO total + number SEND total TO DISPLAY UNTIL total > 100

Over 100 (with each number <= 20) SET total TO 0 REPEAT RECEIVE number FROM KEYBOARD IF number > 20 THEN SEND “number too big” TO DISPLAY END IF UNTIL number <= 20 SET total TO total + number SEND total TO DISPLAY UNTIL total > 100

Programming Tasks Complete the programming tasks on pages 73-75 Extension Sets 6 & 6b

Success Criteria I can create an input validation algorithm using a conditional loop.