BOISE STATE CS 120 - ch10 (32 pages)

Previewing pages 1, 2, 15, 16, 31, 32 of 32 page document View the full content.
View Full Document

ch10



Previewing pages 1, 2, 15, 16, 31, 32 of actual document.

View the full content.
View Full Document
View Full Document

ch10

77 views


Pages:
32
School:
Boise State University
Course:
Cs 120 - Introduction to Programming Concepts
Introduction to Programming Concepts Documents

Unformatted text preview:

Alice in Action with Java Chapter 10 Flow Control in Java Objectives Learn how to use the if statement Learn how to use the switch statement Learn how to use the while loop Learn how to use the for loop Learn how to use the do loop Alice in Action with Java 2 Flow Control In Java Purpose of using selective and repetitive execution Implement methods that produce complex behaviors Selective flow control statements if and switch Repetitive flow control statements while for do Alice in Action with Java 3 Selective Execution Directing flow based on the value of a condition Two statements that provide selective execution if statement general purpose selection structure switch statement multi branch selection structure Alice in Action with Java 4 Java s if Statement General purpose selection structure Selects from one or more groups of statements The else portion of the if statement is optional One branch if envisioned as branching flow Two branch if flow follows one of two branches Alice in Action with Java 5 Java s if Statement continued Alice in Action with Java 6 Java s if Statement continued Alice in Action with Java 7 Java s if Statement continued Pattern for Java s if statement if Condition Statement1 else Statement2 Condition any boolean expression Statementi set of Java statements within Brackets are optional if only one statement is in path Multi branch if statements aka if else chain Flow can move along multiple paths Nest additional if statements in the else clause Alice in Action with Java 8 Java s if Statement continued Alice in Action with Java 9 Alice in Action with Java 10 Repetitive Execution Program execution flows sequentially by default if and switch perform statements selectively Repetitive execution control flows in loops Three repetition statements while for and do Alice in Action with Java 11 Java s while Statement Used for processing a series of values Input loops read and process a series of values Sentinel controlled input loops Utilize a



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view ch10 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view ch10 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?