tailieunhanh - Lecture An introduction to computer science using java (2nd Edition): Chapter 4 - S.N. Kamin, D. Mickunas, E. Reingold

Chapter 4 - Decision making. In this chapter we will: discuss the use of decision making in computer programming, describe the use of the Java if and switch statements, describe the use of Boolean expressions in Java if statements, discuss the use of integer selector variables in Java switch statements. | Chapter 4 Decision Making Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by . Kamin, D. Mickunas, E. Reingold Chapter Preview In this chapter we will: discuss the use of decision making in computer programming describe the use of the Java if and switch statements describe the use of Boolean expressions in Java if statements discuss the use of integer selector variables in Java switch statements if Statement Ensures that a statement is executed only when a condition is true Conditions typically involve comparison of variables or quantities for equality or inequality Example: if (age >= 18) (“You are eligible to vote.”); Relational Operators if Statement with Optional else An if statement may have an optional else clause that will only be executed when the condition is false Example: if (wages = 18) (“You are eligible to vote.”); Relational Operators if Statement with Optional else An if statement may have an optional else clause that will only be executed when the condition is false Example: if (wages <= 57600) tax = * wages; else tax = * 57600; Compound Alternatives To execute more than one statement conditionally, you may use

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.