Lecture17 - Java Programming 3e Concepts and Techniques...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Java Programming, 3e Concepts and Techniques Chapter 4 Decision Making and Repetition with Reusable Objects (IV) ICTN 2730 Lecture 17 02/20/2008
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 4: Decision Making and Repetition with Reusable Objects 2 Assignments Read chapter 4 and lecture notes Homework 4 sample solutions have been posted and will be discussed on Friday. Homework 5 is due tonight. Quiz 2, covering chapters 3 - 4 and lectures 09-18, will be available on Blackboard from 7 pm Sunday (2/24) till 9 pm Monday (2/25).
Background image of page 2
Chapter 4: Decision Making and Repetition with Reusable Objects 3 The Case Structure A type of selection structure that allows for more than two choices when the condition is evaluated Used when there are many possible, valid choices for user input The code evaluates the user choice with a switch statement and looks for a match in each case statement Each case statement contains an ending break statement which forces exit of the structure
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 4: Decision Making and Repetition with Reusable Objects 4 The Case Structure switch(employeeCode) { case 1: commission = .10 * employeeSales; break; case 2: commission = .14 * employeeSales; break; case 3: commission = .18 * employeeSales; break; } (The value is usually an integer but can have other data type, e.g. Char.) Condition Action 1 Action 2 Action 3 Action n Case 1 Case 2 Case 3 Case n …….
Background image of page 4
Chapter 4: Decision Making and Repetition with Reusable Objects 5 The getComm() Method
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 4: Decision Making and Repetition with Reusable Objects 6 Homework 5 – NewCommission2
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 22

Lecture17 - Java Programming 3e Concepts and Techniques...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online