CHAPTER 12 — Decision Making

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   hear noise   go to next page

Revised: 9/26/98, 08/01/99, 12/09/99, 01/12/06, 07/09/08

CHAPTER 12 — Decision Making

This chapter looks at how computer programs make decisions using the if statement. This statement is one of the fundamental building blocks of programming.

stormy weather

Chapter Topics:

  • Two-way Decisions
  • The if statement
  • Outline of a two-way decision
  • Blocks of statements
  • Boolean Expressions
  • Relational Operators
  • Example Programs

QUESTION 1:

You are driving in your car and it starts to rain. The rain falls on your windshield and makes it hard to see. Should your windshield wipers be on or off?