While studying, look for the activity icon for: Vocabulary terms with e-flash cards and matching activities. Starter files for hands-on examples and other exercises. These activities can be accessed at www.g-wlearning.com/informationtechnology/1773 Variables T he job of a program is to input data, process that data, and output results. For each program, the data, the processing, and the output is different. For example, for a program written to calculate the circumference of a circle, the input data would be the circle’s diameter and the value of pi. The calculation would be pi multiplied by the diameter. The output would be the result of the calculation, which is the circle’s circumference. Java provides ways to keep the data in memory while a program executes. Each data item is given a name. In doing so, what kind of data the item is must be specified as well as how the data is intended to be used. In the case of calculating a circumference, the names diameter, pi, and circumference might be used. Java can then be told these will be real numbers. Eventually, the programmer will tell Java what to do with the numbers after they have been identified and stored. Reading Prep Before reading this chapter, read the essential question for each section. Write a short paragraph in response to the question. Share your answer with a classmate. Discuss how each other’s answers relate to the chapter topic. College and Career Readiness CHAPTER 4 Sections 4.1 Identifiers and Data Types 4.2 Variable Values Copyright Goodheart-Willcox Co., Inc. 72
Previous Page Next Page