Chapter 5 - Chapter Five Decisions Chapter Goals To be able to implement decisions using if statements To understand how to group statements into blocks

Chapter 5 - Chapter Five Decisions Chapter Goals To be able...

This preview shows page 1 - 7 out of 39 pages.

11/7/2008 1 Chapter Five: Decisions • To be able to implement decisions using if statements • To understand how to group statements into blocks • To learn how to compare integers floating-point numbers Chapter Goals To learn how to compare integers, floating-point numbers, strings, and objects • To recognize the correct ordering of decisions in multiple branches • To program conditions using Boolean operators and variables To understand the importance of test coverage To understand the importance of test coverage
Image of page 1
11/7/2008 2 • The if statement lets a program carry out different actions depending on a condition if (amount <= balance) balance = balance amount; The if Statement balance = balance – amount; if (amount <= balance) balance = balance – amount; else balance = balance – OVERDRAFT_PENALTY The if / else Statement
Image of page 2