6.
if (toupper(department) == ‘A’ || toupper(department) == ‘B’)
raise = salary * 0.02;
7. The corrections are shaded.
if (toupper(code) == ‘X’)
Exercises – Computer
8. The answer to this TRY THIS Exercise is located at the end of Chapter 5 in the book. The code is entered
in the TryThis8.cpp file, which is contained in either the Cpp8\Chap05\TryThis8 Project-IM folder
(Microsoft) or the Cpp8\Chap05 folder (non-Microsoft).
9. The answer to this TRY THIS Exercise is located at the end of Chapter 5 in the book. The code is entered
11. See the Introductory11.cpp file, which is contained in either the Cpp8\Chap05\Introductory11 Project-IM
folder (Microsoft) or the Cpp8\Chap05 folder (non-Microsoft).
Input Processing Output
pounds Processing items: total owed
price per pound sales tax
charged for sales tax (Y or N)
sales tax rate (3.5%)
Algorithm:
1. enter the pounds, price per pound, and charged for sales tax
2. calculate the total owed by multiplying the pounds
by the price per pound
pounds price per pound charged for sales tax sales tax rate sales tax total owed
5 13.69 Y .035 2.40 68.45