CHAPTER #6 Problem Solving with Case Structure Overview Case logical structure Code Menu.

Slides:



Advertisements
Similar presentations
Program Flowchart, Pseudocode & Algorithm development
Advertisements

Programming Logic and Design Sixth Edition
UNIT 3 PROBLEM SOLVING WITH LOOP AND CASE LOGIC STRUCTURE
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Reference :Understanding Computers
Chapter 2- Visual Basic Schneider
Lab/Sessional -CSE-374. SYSTEM DEVELOPMENT LIFE CYCLE.
Chapter 1 Program Design
Chapter 3 Planning Your Solution
Chapter 5 Problem Solving with the Sequential Logic Structure
Copyright © 2012 Pearson Education, Inc. Chapter 2 Beginning Problem-Solving Concepts for the Computer Problem Solving and Programming Concepts 9 th Edition.
Copyright © 2012 Pearson Education, Inc. Chapter 6 Problem Solving with Decisions Problem Solving and Programming Concepts 9 th Edition By Maureen Sprankle.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Chapter 3 Planning Your Solution
Copyright © 2016 McGraw-Hill Education. All rights reserved. No reproduction or distribution without the prior written consent of McGraw-Hill Education.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Computer Programming 12 Lesson 2 - Organizing the Problem By Dan Lunney.
McGraw-Hill/Irwin Introduction to QuickBooks Pro, 2004 © 2005 The McGraw-Hill Companies, Inc., All Rights Reserved. Chapter 8 Payroll Setup.
©2013 Cengage Learning. All Rights Reserved. Business Management, 13e Management, Supervision, and Decision Making Increasing Management Effectiveness.
Programming Logic and Design Fourth Edition, Introductory
Programming Concepts Chapter 3.
Problem Solving with Decisions
B065: PROGRAMMING OPERATORS AND SELECTION 2. Starter  What do each of the following mean? Write an example of how each could be used. Symbol = <
Programming Logic and Design, Second Edition, Comprehensive
Describe the Program Development Cycle. Program Development Cycle The program development cycle is a series of steps programmers use to build computer.
Chapter 5: More on the Selection Structure Programming with Microsoft Visual Basic 2005, Third Edition.
PROBLEM SOLVING WITH LOOPS Chapter 7. Concept of Repetition Structure Logic It is a computer task, that is used for Repeating a series of instructions.
Chapter 5: Making Decisions
Computer Programming I Summer 2011
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Programming Logic and Design Fifth Edition, Comprehensive Chapter 6 Arrays.
Payroll Setup Chapter 6. PAGE REF #CHAPTER 6: Payroll Setup SLIDE # 2 2 Objectives Activate the payroll feature and configure payroll preferences Set.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
1 Structured Programming Arab Academy for Science and Technology CC112 Dr. Sherif Mohamed Tawfik The Course.
Problem Solving with Decission Structure
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
 Problem Analysis  Coding  Debugging  Testing.
Chapter 3 IFTHENELSE Control Structure © 2008 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved. Marilyn Bohl/Maria Rynn Tools for Structured.
Chapter One Problem Solving
ALGORITHMS AND FLOWCHARTS
Understand Problem Solving Tools to Design Programming Solutions
Programming Logic and Design Seventh Edition
More on the Selection Structure
Chapter 2: Input, Processing, and Output
Chapter 2- Visual Basic Schneider
The Selection Structure
Programming Logic and Design Eighth Edition
Understand Problem Solving Tools to Design Programming Solutions
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
( Iteration / Repetition / Looping )
Programming Fundamentals
Microsoft Visual Basic 2005 BASICS
VISUAL BASIC – CHAPTER ONE NOTES An Introduction to Visual Basic
How to develop a program?
Open enrollment is on the horizon Open enrollment is on the horizon
Accounting Systems & Business Processes Chapter 4
Using QuickBooks Pro for Accounting 2008 Glenn Owen
Chapter 2- Visual Basic Schneider
Accounting Systems & Business Processes Chapter 4
Chapter 2- Visual Basic Schneider
Chapter 5: Control Structure
Flowcharting & Algorithms
Data and Flowcharts Session
Programming Logic and Design Fifth Edition, Comprehensive
Data and Flowcharts Session
Chapter 2: Input, Processing, and Output
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.
Control Structures.
Presentation transcript:

CHAPTER #6 Problem Solving with Case Structure

Overview Case logical structure Code Menu

Objectives Develop problems using the case logic structure Use problem-solving tools when developing a solution using the case logic structure

Background Sometimes a solution to a problem requires the computer to select one action from a set of actions

Menu What is a menu? – option/case What you have to do with menu? – select/decide Does everything appears on menu? –not it doesn’t What if your choice doesn’t exist? –going home, find another menu/default action (optional)

Critical Thinking This kind of solution can be designed through the decision logic structure But the case logic structure is more efficient for this purpose The case logic structure is a special variation of the decision structure

How it appears? This structure is used in many business- related problems, such as those dealing with types of accounts in a bank, types of insurance available to an employee, or the selection of a bonus. Etc. We will make a menu using Case structure

General Form of Case Logic Structure CaseOf actions for actions for... Otherwise: actions when all other conditions are False EndOfCase This symbols indicated that there might be presents soo many ‘options’

Figure 6.17 Flowchart Diagram for the Case Logic Structure

Figure 6.18 Alternate Flowchart Diagram for the Case Logic Structure

How to decide? We use CODES Codes are characters, character strings, numbers, or some combination of these types of data to name the options, the constants, in a case structure Abbreviations for each of the options Example : B for Best Medical Insurance Company, D for Direct Medical Insurance Company, and the like

Codes as Indicators A code is used to indicate choices Ex : The type of insurance an employee is buying, the gender of an individual, or the vendor in an inventory problem When using codes, the Otherwise option indicates an error Without the use of codes, solutions requiring a choice from among several options would be longer, harder to read, and more difficult to maintain.

Problem A company has four different medical plans. The programmer has given each plan a code corresponding to the beginning initial of the company: Plan 1 = F Plan 2 = B Plan 3 = K Plan 4 = E

Problem (cont.) The company pays for all of Plan 1. The individual has to pay for part of the others. The payroll deduction for Plan 2 = 4.65, for Plan 3 = 7.85 and for Plan 4 = 5.50 Any other codes are considered in error. Write the algorithm and draw the flowchart for a module to determine the payroll deduction

Using Codes - InsuranceDeduction

Example Foods Menu 1.Soto 2.Sate 3.Soup 4.Exit Enter your choice : _

Conclusion What is Case structure? How do this differs from decission structure? Could you implement this structur for creating menu? Make sure you have choose what is your code use.