Selection: CASE Statement Damian Gordon. Selection As well as the IF Statement, another form of SELECTION is the CASE statement.

Slides:



Advertisements
Similar presentations
Jeopardy Click the Start button to begin the game. On the Category Board, click the button to select your question. On each question card, click the button.
Advertisements

Quiz By: Steven Hancock Click START to begin the quiz. ALGEBRA.
Item Analysis What makes a question good??? Answer options?
True/False. False True Subject May Go Here True / False ? Type correct answer here. Type incorrect answer here.
Python: Modularisation Damian Gordon. Modularisation Remember the prime checker program:
Selection: IF Statement Damian Gordon. adsdfsdsdsfsdfs dsdlkmfsdfmsdl kfsdmkfsldfmsk dddfsdsdfsd.
 Math 6A, 7A, Algebra 1 – Mrs. A. BACK TO SCHOOL 2014.
Iteration: WHILE Loop Damian Gordon. WHILE Loop Consider the problem of searching for an entry in a phone book with only SELECTION:
It’s All About Properties of Equality. How could properties of equality be applied to solve this equation? Example 1: 3x + 11 = 32 What is the value of.
Test Your Knowledge. x + 3 =6 a.5 b.4 c.3 d.2 y - 11= 78 a. 69 b. 89 c. 87 d. 68.
$1,000,000 $500,000 $100,000 $50,000 $10,000 $5000 $1000 $500 $200 $100 Is this your Final Answer? YesNo Question 2? Correct Answer Wrong Answer.
HOW TO FILL OUT A PARSCORE FORM Genius 40% of ALL Students make errors on their ParScore Forms DON’T BE AN ERROR VICTIM!
Sorting: Selection Sort Damian Gordon. Sorting: Selection Sort OK, so we’ve seen a way of sorting that easy for the computer, now let’s look at a ways.
Prime Numbers Damian Gordon. Prime Numbers So let’s say we want to express the following algorithm: – Read in a number and check if it’s a prime number.
Python: Selection Damian Gordon. Python: Selection We’ll consider two ways to do selection: The IF statement The CASE statement.
The Scientific Method Valeria Paiz HWK of TECHNOLOGY.
Single Digit Addition Flash cards.  The program starts with introduction.  Today, we’re going to play single digit numbers addition and flash cards.
MODULE FOUR QUIZ. CHOOSE THE STATEMENT WHICH IS FALSE MODULE FOUR QUIZ DIGITAL MARKETING CONSULTING & TRAINING
DIGITAL MARKETING CONSULTING & TRAINING ©JASMINE SANDLER MODULE TWO QUIZ.
Python: Iteration Damian Gordon. Python: Iteration We’ll consider four ways to do iteration: – The WHILE loop – The FOR loop – The DO loop – The LOOP.
Quiz About Your Topic Question 1 A question about your topic: A. [Insert incorrect answer] C. [Insert incorrect answer] B. [Insert incorrect answer]
Recursion Damian Gordon. Recursion Factorial Fibonacci Decimal to Binary conversion Travelling Salesman Problem Knight’s Tour.
Iteration: FOR, DO, LOOP Loop Damian Gordon. FOR Loop The FOR loop does the same thing as a WHILE loop but is easier if you are using the loop to do a.
Multiplication Timed Tests.
QUESTIONS, ANSWERS, AND OPTIONS. In writing You must make an attested will in writing. It must be printed as a document. Signed If you make.
Special Triangles Review
Introduction to Python
36 x 2 = ? A) 36 B) 72 C) 48 D) 76.
Standard and Expanded Form
Primary Longman Elect 2A Chapter 6 Meet my family Do you have …?
Box Factoring or acb Method
Chapter 4: Control Structures
Inequalities and Their Graphs
Boolean Logic Damian Gordon.
Quiz About [Your topic]
ALGORITHM BASICS- Part 3
Index Notation Thursday, 29 November 2018.
סדר דין פלילי – חקיקה ומהות ההליך הפלילי
Gordon g. Giesbrecht, PhD, Thea Pretorius, MSc 
Queues: Implemented using Arrays
How are your SAS Skills? Chapter 1: Accessing Data (Question # 1)
Python: Algorithms Damian Gordon.
Some Common Issues: Iteration

Best Smart Home Automation Solution - eDesign Group
X Bad 1 Bad 2 Bad 3 Good 1 Good 2 Good 3 Question
Find the reference angle for the angle measuring {image}
SQUADS #2 CPW25 “10th Grade Math”
1 N ≤ ,2,3,4,5 7,8,9,10 … 6,5,4,3… 6 ,7 ,8,9… J Hitchcox © 2009.
Sorting Damian Gordon.
Selection Structures: Single-alternative
Circular Queues: Implemented using Arrays
Some Common Issues: Print, Maths, Variables
Do you trust the 8 Ball? The 8 Ball always knows..
SQUADS #2 CPW25 “9th Grade Math”
English II Benchmark.
Some Common Issues: Common Algorithms
You must show all steps of your working out.
Question 1.
Chapter 3: Selection Structures: Making Decisions
Warmup Chapter P Review
Complete the family of four
True or False True or False
Complete the spreadsheet with the table headings
Control Structures.
Given that {image} {image} Evaluate the limit: {image} Choose the correct answer from the following:
Drag the blue box to the correct answer.
Module 3 Selection Structures 12/7/2019 CSE 1321 Module 3.
Presentation transcript:

Selection: CASE Statement Damian Gordon

Selection As well as the IF Statement, another form of SELECTION is the CASE statement.

CASE Statement If we had a multi-choice question:

CASE Statement If we had a multi-choice question:

CASE Statement Read Answer; IF (Answer = ‘A’) THEN Print “That is incorrect”; ELSE IF (Answer = ‘B’) THEN Print “That is incorrect”; ELSE IF (Answer = ‘C’) THEN Print “That is Correct”; ELSE IF (Answer = ‘D’) THEN Print “That is incorrect”; ELSE Print “Bad Option”; END IF;

CASE Statement PROGRAM MultiChoiceQuestion: Read Answer; IF (Answer = ‘A’) THEN Print “That is incorrect”; ELSE IF (Answer = ‘B’) THEN Print “That is incorrect”; ELSE IF (Answer = ‘C’) THEN Print “That is Correct”; ELSE IF (Answer = ‘D’) THEN Print “That is incorrect”; ELSE Print “Bad Option”; ENDIF; END.

CASE Statement Read Answer; CASE OF Answer ‘A’ :Print “That is incorrect”; ‘B’ :Print “That is incorrect”; ‘C’ :Print “That is Correct”; ‘D’ :Print “That is incorrect”; OTHER:Print “Bad Option”; ENDCASE;

CASE Statement PROGRAM MultiChoiceQuestion: Read Answer; CASE OF Answer ‘A’ :Print “That is incorrect”; ‘B’ :Print “That is incorrect”; ‘C’ :Print “That is Correct”; ‘D’ :Print “That is incorrect”; OTHER:Print “Bad Option”; ENDCASE; END.

CASE Statement Or, in general: CASE OF Value Option1: ; Option2: ; Option3: ; Option4: ; OTHER : ; ENDCASE;

START END Option1 No Read in A Yes Print “Option 1” Option2 No Yes Print “Option 2” OTHER No Yes Print “OTHER”

CASE Statement Read Result; CASE OF Result Result => 70 :Print “You got a first”; Result => 60 :Print “You got a 2.1”; Result => 50 :Print “You got a 2.2”; Result => 40 :Print “You got a 3”; OTHER :Print “Dude, you failed”; ENDCASE;

CASE Statement PROGRAM GetGrade: Read Result; CASE OF Result Result => 70 :Print “You got a first”; Result => 60 :Print “You got a 2.1”; Result => 50 :Print “You got a 2.2”; Result => 40 :Print “You got a 3”; OTHER :Print “Dude, you failed”; ENDCASE; END.

etc.