CSC 1350 Chapter : Notes For Chapter 2
Document Summary
Most computer programs hold temporary values in named storage locations. There are many different types of storage to hold different things. You declare a variable by telling the compiler: What name you will use to refer to it. Integer, data types, whole numbers, positive or negative. Decimal related, professor recommends double as to float, its stored in twice as much memory. Identifier cannot begin with a digit: a whole number, a number with a fraction part, a word int double. Capitalize every first letter of a word after the variable int cansperpack = 6; double canvolume = 12. 0; When a variable is defined with the reserved word final, its value can never be changed. It is good style to use named constants to explain numerical values to be used in calculations. Which is clearer? double totalvolume = bottles * 2; double totalvolume = bottles * bottle_volume; Might need to ask for input and then save what was entered.