|
Is the following
A good answer might be:No. The indenting and line breaks are different, but logically it is the same as:
(Some programmers use this style, apparently thinking that "saving" lines is somehow good. This may once have been true, when terminals could only display 23 lines at a time and you didn't want to waste them. But the style leads to errors and extra debuging time.) | |
Asking the Right QuestionSay that you are shopping at the Mall and find a $44.95 sweater you like, but (due to an impulsive cookie purchase) you might not have enough money to buy it. Here is a program that decides if you get the sweater:
The reserved word final in the fifth line says that the value held in price will not be changed during the run of the program. This is not necessary, but if you use it, the compiler will check that you have not accidentally written a statement that tries to change the value. In long programs this is very useful. | |
QUESTION 7:What boolean expression should be in the blank? (Assume that there is no sales tax.) Click Here after you have answered the question |