Programming Logic and Design Fourth Edition, Comprehensive Chapter 10 Using Menus and Validating Input.

Slides:



Advertisements
Similar presentations
Testing Relational Database
Advertisements

Chapter 8 Improving the User Interface
Chapter 07: Lecture Notes (CSIT 104) 1111 Exploring Microsoft Office Excel 2007 Chapter 7 Data Consolidation, Links, and Formula Auditing.
Programming Logic and Design Eighth Edition
1 Software Engineering Lecture 11 Software Testing.
Intermediate GNVQ ICT The human computer interface The human computer interface is what allows the user to communicate with the computer and is often called.
Programming Logic and Design Fourth Edition, Introductory
Objectives In this chapter, you will learn about:
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
Testing an individual module
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 1 Program Design
Chapter 14: Event-Driven Programming with Graphical User Interfaces
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Chapter 9 THE ACQUISITION CYCLE— PURCHASING AND RECEIVING
© 2005 by Prentice Hall Chapter 3c Designing Interfaces and Dialogues.
Program Input and the Software Design Process ROBERT REAVES.
Online testing made effective and easy. The easy way to have your tests answered and scored online. If you have a test in a PDF file, it can be online.
1 Functional Testing Motivation Example Basic Methods Timing: 30 minutes.
1 Wireless Warehouse Management System Compsee’s M.A.T. Mobile Application Terminal.
Chapter 12 Designing Interfaces and Dialogues
Structured COBOL Programming, Stern & Stern, 9th edition
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
CMSC 345 Fall 2000 Unit Testing. The testing process.
Output and User Interface Design
Department of Mechanical Engineering, LSUSession VII MATLAB Tutorials Session VIII Graphical User Interface using MATLAB Rajeev Madazhy
GUI Widgets Jeff Offutt SWE 432 Design and Implementation of Software for the Web.
Software Development Software Testing. Testing Definitions There are many tests going under various names. The following is a general list to get a feel.
Programming Logic and Design Fifth Edition, Comprehensive
System Analysis and Design
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
1 Intro to Java Week 12 (Slides courtesy of Charatan & Kans, chapter 8)
Black Box Testing Techniques Chapter 7. Black Box Testing Techniques Prepared by: Kris C. Calpotura, CoE, MSME, MIT  Introduction Introduction  Equivalence.
Programming Logic and Design Sixth Edition Chapter 5 Looping.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 4 Looping.
SD1230 Unit 6 Desktop Applications. Course Objectives During this unit, we will cover the following course objectives: – Identify the characteristics.
Copyright © 2008 Pearson Prentice Hall. All rights reserved Copyright © 2008 Prentice-Hall. All rights reserved. Committed to Shaping the Next.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 8 Arrays.
Java Programming, 2E Introductory Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects.
13-1 Sequential File Processing Chapter Chapter Contents Overview of Sequential File Processing Sequential File Updating - Creating a New Master.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 10: Using Menus and Validating Input Programming Logic and Design, Third Edition Comprehensive.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Chapter 11 Data Validation. Question Should your program assume the data is correct, or should your program edit the data to ensure it is correct?
1 AQA ICT AS Level © Nelson Thornes 2008 Good quality data and information Data terms.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Chapter 3 Data Control Ensure the Accurate and Complete data is entering into the data processing system.
Chapter 9: Completing the Basics. In this chapter, you will learn about: – Exception handling – Exceptions and file checking – The string class – Character.
10 Chapter 101 Using Menus and Validating Input Programming Logic and Design, Second Edition, Comprehensive 10.
11- 1 Chapter 11.  Avoiding Logic Errors by Validating Input  What to Do If Input Errors Occur  Global Considerations in COBOL  When Data Should Be.
 Software Testing Software Testing  Characteristics of Testable Software Characteristics of Testable Software  A Testing Life Cycle A Testing Life.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 14 Event-Driven Programming with Graphical User Interfaces.
IMS 3253: Validation and Errors 1 Dr. Lawrence West, MIS Dept., University of Central Florida Topics Validation and Error Handling Validation.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
1 Unit E-Guidelines (c) elsaddik SEG 3210 User Interface Design & Implementation Prof. Dr.-Ing. Abdulmotaleb.
Dynamic Black-Box Testing Part 1 What is dynamic black-box testing? How to reduce the number of test cases using: Equivalence partitioning Boundary value.
Programming Logic and Design Seventh Edition Chapter 12 Event-Driven GUI Programming, Multithreading, and Animation.
Chapter 13 & 14 Software Testing Strategies and Techniques
Designing and Debugging Batch and Interactive COBOL Programs
Programming Logic and Design Fourth Edition, Comprehensive
Chapter 15: GUI Applications & Event-Driven Programming
Chapter 7: Input Validation
Part 6 Q26 to Q30 of National 5 Prelim
Chapter 10: Using Menus and Validating Input
Chapter 13 & 14 Software Testing Strategies and Techniques 1 Software Engineering: A Practitioner’s Approach, 6th edition by Roger S. Pressman.
Presentation transcript:

Programming Logic and Design Fourth Edition, Comprehensive Chapter 10 Using Menus and Validating Input

Programming Logic and Design, Fourth Edition, Comprehensive2 Objectives Understand the need for interactive, menu-driven programs Create a program that uses a single-level menu Code modules as black boxes Improve menu programs Use a case structure to manage a menu

Programming Logic and Design, Fourth Edition, Comprehensive3 Objectives (continued) Create a program that uses a multilevel menu Validate input Understand types of data validation

Programming Logic and Design, Fourth Edition, Comprehensive4 Using Interactive Programs Two kinds of programs, based on how they get data: –Batch processing: data are gathered prior to running –Interactive processing: depends on user input Batch processing typically reads a file of transactions and processes them Offline: transactions gathered prior to the run Real-time applications (or online processing) run while the transaction is taking place

Programming Logic and Design, Fourth Edition, Comprehensive5 Using Interactive Programs (continued) Menu program: interactive program that displays a set of options to the user Console application: requires the user to enter a choice using the keyboard Graphical user interface (GUI) application: user selects option using mouse or other pointing device

Programming Logic and Design, Fourth Edition, Comprehensive6 Using Interactive Programs (continued) Menus should always have a “quit” choice

Programming Logic and Design, Fourth Edition, Comprehensive7 Using a Single-Level Menu Single-level menu: selection from only one menu Mainline logic must check user’s input each time to determine if the program should end Use a variable to hold user’s response to the menu

Programming Logic and Design, Fourth Edition, Comprehensive8 Using a Single-Level Menu (continued) Developing the application: mainline logic

Programming Logic and Design, Fourth Edition, Comprehensive9 Using a Single-Level Menu (continued) Developing the application: startup () module

Programming Logic and Design, Fourth Edition, Comprehensive10 Using a Single-Level Menu (continued) Developing the application: displayMenu() module

Programming Logic and Design, Fourth Edition, Comprehensive11 Using a Single-Level Menu (continued) Developing the application: looping() module

Programming Logic and Design, Fourth Edition, Comprehensive12 Using a Single-Level Menu (continued) Developing the application: –cleanup() module

Programming Logic and Design, Fourth Edition, Comprehensive13 Coding Modules as Black Boxes Contents of program modules should not affect the main structure of the program in any way Black box modules: module statements are encapsulated in a container, making them invisible from the rest of the program Concentrate on the mainline logic first and what the modules will do, not how they will do it Stub: empty black box procedure

Programming Logic and Design, Fourth Edition, Comprehensive14 Coding Modules as Black Boxes (continued) Developing the application:

Programming Logic and Design, Fourth Edition, Comprehensive15 Coding Modules as Black Boxes (continued) Developing the application: –Improvement: using arrays

Programming Logic and Design, Fourth Edition, Comprehensive16 Coding Modules as Black Boxes (continued) Developing the application:

Programming Logic and Design, Fourth Edition, Comprehensive17 Coding Modules as Black Boxes (continued) Improvement: using built-in functions

Programming Logic and Design, Fourth Edition, Comprehensive18 Making Improvements to a Menu Program Improvement: trapping bad user input

Programming Logic and Design, Fourth Edition, Comprehensive19 Making Improvements to a Menu Program (continued) Improvement: tracking user errors

Programming Logic and Design, Fourth Edition, Comprehensive20 Making Improvements to a Menu Program (continued) The complete program:

Programming Logic and Design, Fourth Edition, Comprehensive21 Making Improvements to a Menu Program (continued) The complete program (continued):

Programming Logic and Design, Fourth Edition, Comprehensive22 Using the Case Structure to Manage a Menu Case structure: –Tests a single variable against several possible values –Useful for handling menu choices –Use default option to handle bad user input User-friendly: program should make it easy for the user to make desired choices

Programming Logic and Design, Fourth Edition, Comprehensive23 Using the Case Structure to Manage a Menu (continued) Developing the application:

Programming Logic and Design, Fourth Edition, Comprehensive24 Using the Case Structure to Manage a Menu (continued) Using a case structure for the input choice:

Programming Logic and Design, Fourth Edition, Comprehensive25 Using the Case Structure to Manage a Menu (continued) Handling variations of user input:

Programming Logic and Design, Fourth Edition, Comprehensive26 Using Multilevel Menus Multilevel menu: selection of one option leads to another menu with further, refined selections Multilevel menus eliminate problems caused by: –Too many options to fit on the display at one time –Screen is too crowded –User confusion caused by too many choices Submenu: a second-level (or later) menu

Programming Logic and Design, Fourth Edition, Comprehensive27 Using Multilevel Menus (continued)

Programming Logic and Design, Fourth Edition, Comprehensive28 Using Multilevel Menus (continued) Developing the application: mainline logic

Programming Logic and Design, Fourth Edition, Comprehensive29 Using Multilevel Menus (continued) Developing the application: startup() module

Programming Logic and Design, Fourth Edition, Comprehensive30 Using Multilevel Menus (continued) Developing the application: displayMenu() module

Programming Logic and Design, Fourth Edition, Comprehensive31 Using Multilevel Menus (continued) Developing the application: looping() module

Programming Logic and Design, Fourth Edition, Comprehensive32 Using Multilevel Menus (continued) Developing the application: addition() module

Programming Logic and Design, Fourth Edition, Comprehensive33 Using Multilevel Menus (continued) Developing the application: –d isplayDifficultyMenu() module

Programming Logic and Design, Fourth Edition, Comprehensive34 Using Multilevel Menus (continued) Techniques are the same for all levels of menus: –Display the menu –Accept a response –Perform a module based on the selection –Display the menu again

Programming Logic and Design, Fourth Edition, Comprehensive35 Validating Input Defensive programming: trying to prepare for all possible errors before they occur Incorrect user entries are the most common error Validating input: –Check user responses to ensure they are within acceptable bounds –Does not eliminate all program errors Common programming errors: –Incorrect logic to check for valid responses –Failing to account for multiple invalid entries

Programming Logic and Design, Fourth Edition, Comprehensive36 Validating Input (continued) Invalid use of OR logic: Improved logic:

Programming Logic and Design, Fourth Edition, Comprehensive37 Validating Input (continued) Best logic:

Programming Logic and Design, Fourth Edition, Comprehensive38 Understanding Types of Data Validation Need to handle all aspects of validation, including: –Data type –Range –Reasonableness and consistency of data –Presence of data

Programming Logic and Design, Fourth Edition, Comprehensive39 Validating a Data Type Some languages provide built-in functions for checking data type Can accept user input as a string and then attempt to use conversion methods to get correct data type –If conversion fails, input data was the wrong type

Programming Logic and Design, Fourth Edition, Comprehensive40 Validating a Data Range Similar technique to validating an exact value

Programming Logic and Design, Fourth Edition, Comprehensive41 Validating Reasonableness and Consistency of Data Data input can be the correct type and within range, but still be incorrect Check for obvious logical relationships, such as: –Payment date cannot occur before purchase date –Zip code falls within the state –Birth date produces a reasonable age

Programming Logic and Design, Fourth Edition, Comprehensive42 Validating Presence of Data Must handle the possibility of missing data Some programming languages provide built-in functions to test for blank or null values

Programming Logic and Design, Fourth Edition, Comprehensive43 Summary Batch programs process data collected earlier Interactive programs collect user data in real time Single-level menu allows user to select a choice of actions Black-box module is independent of the rest of the program Must handle invalid user selections from menu

Programming Logic and Design, Fourth Edition, Comprehensive44 Summary (continued) Case structure handles multiple menu options Multilevel menu manages large number of options Validate all user input Validate for –Correct data type –Data within acceptable ranges –Data is reasonable and consistent –Data is present