O'Reilly logo

Beginning Programming with Java For Dummies, 5th Edition by Barry A. Burd

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10

Which Way Did He Go?

IN THIS CHAPTER

check Untangling complicated conditions

check Writing cool conditional code

check Intertwining your if statements

It’s tax time again. At the moment, I’m working on Form 12432-89B. Here’s what it says:

If you’re married with fewer than three children, and your income is higher than the EIQ (Estimated Income Quota), or if you’re single and living in a non-residential area (as defined by Section 10, Part iii of the Uniform Zoning Act), and you’re either self-employed as an LLC (Limited Liability Company) or you qualify for veterans’ benefits, then skip Steps 3 and 4 or 4, 5, and 6, depending on your answers to Questions 2a and 3d.

No wonder I have no time to write! I’m too busy interpreting these tax forms.

Anyway, this chapter deals with the potential complexity of if statements. This chapter has nothing as complex as Form 12432-89B, but if you ever encounter something that complicated, you’ll be ready for it.

Forming Bigger and Better Conditions

In Listing 9-2 (refer to Chapter 9), the code chooses a course of action based on one call to the Random class’s nextInt method. That’s fine for the electronic oracle program described in Chapter 9, but what ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required