2. ELEMENTS OF PROGRAMMING
Our goal.
Our goal in this chapter is to convince you that writing a computer
program is easier than writing a piece of text such as a paragraph or an
essay. Writing prose is difficult: we spend many years in school to learn
how to do it. By contrast, just a few building blocks suffice to take us
into a world where we can harness the computer to help us solve all sorts
of fascinating problems that would be otherwise unapproachable. In this
chapter, we take you through these building blocks, get you started on
programming in Java, and study a variety of interesting programs.
Students who learn the programs in this book will have the solid foundation
necessary to prepare them to be able to effectively use computers as they
pursue any academic discipline.
What you will learn.
You will learn the Java programming language, but that will be much
easier to do than learning a foreign language that is unfamiliar to you.
Indeed, programming languages are characterized by no more than a few dozen
vocabulary words and rules of grammar.
Most of the material that we
cover in this chapter could apply to the C or C++ languages, or any of
several other modern programming languages, but we describe everything
specifically in Java so that you can get started creating and running
programs right away. To the extent possible, we will
focus on learning to program, as opposed to learning details about
Java.
