Programming and Problem Solving with Java

(やまだぃちぅ) #1

34


designed to represent real objects in the problem and are described by a class. The in-
structions that make up the program (the source code) are either compiled into
machine code (the language used by the computer) or Bytecode (the language used by
the Java Virtual Machine). After correcting any errors or “bugs” that show up during
testing, the program is ready to use.
Once we begin to use the program, it enters the maintenance phase. Maintenance
involves correcting any errors discovered by users and changing the program to reflect
changes in the users’ requirements.
Data and instructions are represented as binary numbers (numbers consisting of
just 1s and 0s) in electronic computers. The process of converting data and
instructions into a form usable by the computer is called coding.
A programming language reflects the range of operations that a computer can per-
form. In this book, you will learn to write application programs in the high-level
programming language called Java. The basic control structures in the Java
programming language—sequence, selection, loop, subprogram, and asynchronous
control—are based on the fundamental operations of the computer. Java provides the
ability to collect data and operations into self-contained units called objects, as speci-
fied by classes, which other applications can then reuse.
Computers are composed of six basic parts: the memory unit, the arithmetic/logic
unit, the control unit, input devices, output devices, and auxiliary storage devices. The
arithmetic/logic unit and control unit together form the central processing unit. The
physical parts of the computer constitute hardware. The programs that are executed
by the computer are called software. System software is a set of programs designed to
simplify the user/computer interface. It includes the compiler, the operating system,
the JVM, and the editor.
The most important phase of any programming project is the development of the
initial solution to the problem. We use problem-solving techniques such as analogy,
means-ends analysis, divide and conquer, building blocks, and merging solutions to
help us organize our efforts in this phase. Object-oriented problem solving focuses on
the objects in the problem statement, trying to save effort by reusing existing classes of
objects.
The computer is widely used today in science, engineering, business, government,
medicine, production of consumer goods, and the arts. Learning to program in Java
can help you use this powerful tool more effectively. In addition, the problem-solving
skills that you develop through programming can be applied in many noncomputer
contexts.

Quick Check


Quick Check exercises are intended to help you decide whether you’ve met the goals
set forth at the beginning of each chapter. If you understand the material in the chap-
ter, the answer to each question should be fairly obvious. After reading a question,
Free download pdf