tailieunhanh - Lecture An Introduction to Object-Oriented Programming with Java (4/e): Chapter 5 - C. Thomas Wu

Chapter 5 - Selection statements. After you have read and studied chapter 5, you should be able to: Implement a selection control using if statements, implement a selection control using switch statements, write boolean expressions using relational and boolean expressions, evaluate given boolean expressions correctly, nest an if statement inside another if statement, describe how objects are compared, choose the appropriate selection control statement for a given task, define and use enumerated | Chapter 5 Selection Statements 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Objectives After you have read and studied this chapter, you should be able to Implement a selection control using if statements Implement a selection control using switch statements Write boolean expressions using relational and boolean expressions Evaluate given boolean expressions correctly Nest an if statement inside another if statement Describe how objects are compared Choose the appropriate selection control statement for a given task 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. We will study two forms of if statements in this lesson. They are called if-then-else and if-then. Although the compiler does not care how we format the if statements, we will present the recommended style. The if Statement int testScore; testScore = //get test score input if (testScore 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. We assume there’s some kind of input routine to input test score value and assign it to ‘testScore’. This sample shows how to make a decision on the input value by using an if test. if ( testScore ) else Then Block Else Block Boolean Expression 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Control Flow JOptionPane. showMessageDialog (null, "You did pass"); false testScore 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Objectives After you have read and studied this chapter, you should be able to Implement a selection control using if statements Implement a selection control using switch statements Write boolean expressions using relational and boolean expressions Evaluate given boolean expressions correctly Nest an if statement inside another if statement Describe how objects are compared Choose the appropriate selection control statement for a given task 4th Ed Chapter 5 - ©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. We will study two forms of if statements in this lesson. They are called if-then-else and if-then. Although the compiler does not care how we format the if statements, we will present the recommended style. The if Statement int testScore; testScore = //get test score input if (testScore < 70) .

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.