1. Trang chủ
  2. » Thể loại khác

Java - profthinh ď jhtp5_05

48 170 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Chapter 5 – Control Structures: Part 2

  • 5.1 Introduction

  • 5.2 Essentials of Counter-Controlled Repetition

  • WhileCounter.java Line 14 Line 16 Line 18

  • 5.3 for Repetition Statement

  • ForCounter.java Line 16 int counter = 1; Line 16 counter <= 10; Line 16 counter++;

  • PowerPoint Presentation

  • 5.3 for Repetition Structure (cont.)

  • Slide 9

  • 5.4 Examples Using the for Statement

  • Sum.java Line 12

  • Interest.java Lines 13-15 Line 18 Line 19

  • Interest.java Lines 28-31

  • 5.5 do…while Repetition Statement

  • DoWhileTest.java Lines 16-20

  • Slide 16

  • 5.6 switch Multiple-Selection Statement

  • SwitchTest.java Lines 16-21: Getting user’s input

  • SwitchTest.java Line 32: controlling expression Line 32: switch statement Line 48

  • SwitchTest.java

  • Slide 21

  • Slide 22

  • 5.7 break and continue Statements

  • BreakTest.java Line 12 Lines 14-15

  • ContinueTest.java Line 11 Lines 13-14

  • 5.8 Labeled break and continue Statements

  • BreakLabelTest.java Line 11 Line 14 Line 17 Lines 19-20

  • BreakLabelTest.java

  • ContinueLabelTest.java Line 11 Line 14 Line 17 Lines 21-22

  • ContinueLabelTest.java

  • 5.9 Logical Operators

  • Slide 32

  • Slide 33

  • LogicalOperators.java Lines 16-20 Lines 23-27

  • LogicalOperators.java Lines 30-34 Lines 37-41 Lines 44-48 Lines 51-53

  • LogicalOperators.java

  • Slide 37

  • 5.10 Structured Programming Summary

  • Slide 39

  • Slide 40

  • Slide 41

  • Slide 42

  • Slide 43

  • 5.11 (Optional Case Study) Thinking About Objects: Identifying Objects’ States and Activities

  • Slide 45

  • 5.11 (Optional Case Study) Thinking About Objects: Identifying Objects’ States and Activities (cont.):

  • Slide 47

  • Slide 48

Nội dung

Java - profthinh ď jhtp5_05 tài liệu, giáo án, bài giảng , luận văn, luận án, đồ án, bài tập lớn về tất cả các lĩnh vực...

1 Chapter – Control Structures: Part Outline 5.1 Introduction 5.2 Essentials of Counter-Controlled Repetition 5.3 for Repetition Statement 5.4 Examples Using the for Statement 5.5 do…while Repetition Statement 5.6 switch Multiple-Selection Statement 5.7 break and continue Statements 5.8 Labeled break and continue Statements 5.9 Logical Operators 5.10 Structured Programming Summary 5.11 (Optional Case Study) Thinking About Objects: Identifying Objects’ States and Activities 2003 Prentice Hall, Inc All rights reserved 5.1 Introduction • Continue structured-programming discussion – Introduce Java’s remaining control structures  2003 Prentice Hall, Inc All rights reserved 5.2 Essentials of Counter-Controlled Repetition • Counter-controlled repetition requires: – – – – Control variable (loop counter) Initial value of the control variable Increment/decrement of control variable through each loop Condition that tests for the final value of the control variable  2003 Prentice Hall, Inc All rights reserved 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Outline // Fig 5.1: WhileCounter.java // Counter-controlled repetition import java.awt.Graphics; import javax.swing.JApplet; Control-variableCondition name is counter tests for counter’s final value Control-variable initial value is public class WhileCounter extends JApplet { // draw lines on applet’s background public void paint( Graphics g ) { super.paint( g ); // call paint method inherited from JApplet int counter = 1; WhileCounter.ja va Line 14 Line 16 Increment Line for counter 18 // initialization while ( counter

Ngày đăng: 11/12/2017, 19:43

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN

w