1. Write down a meaningful identifier for each data item using Java’s standard naming convention. The first two data items are as follows. The other identifiers you must create. heightInFeet widthInFeet 2. Give a sample value for each data item. Identify and choose an appropriate data type for each data item, int or double. The first two data items may be typed as follows. heightInFeet might be 8 and would be an int widthInFeet might be 11.5 and would be a double 3. Write the Java statements to define the variables. The first two data items are defined as follows. int heightInFeet double widthInFeet Try It! As part of your bedroom renovation, you decide to lay carpet on the floor. You want to write a program to calculate the total cost. The square footage is calculated by multiplying the number of feet in the width by the number of feet in the length. Carpet is sold by the square yard. There are nine square feet in one square yard. Iden- tify the data items needed for this program. For each data item, select an appropriate identifier and data type, then give the Java statement to define the variable. A table like the following can help keep the information organized. Data Item Data Item Identifier Identifier Data Type Data Type Variable Definition Variable Definition SECTION REVIEW 4.1 Check Your Understanding 1. A Java identifier must begin with a(n) _____, _____, or _____. 2. Why is the identifier static invalid in Java? 3. List the eight primitive data types in Java. 4. Which type of programming language is Java, strongly typed or strongly untyped? 5. When defining a variable, which comes first, the data type or the identifier? Build Your Vocabulary As you progress through this course, develop a personal computer science glossary. This will help you build your vocabulary and prepare you for a career. Write a definition for each of the following terms and add it to your computer science glossary. data type identifier primitive data type real number variable Copyright Goodheart-Willcox Co., Inc. Chapter 4 Variables 81