# Programming

1060 Words5 Pages
CHAPTER 2: ALGORITHM WORKBENCH (Input, processing, and output) 3. Write assignment statements that perform the following operations with the variables a, b, and c. a. Adds 2 to a and stores the result in b b. Multiplies b times 4 and stores the result in a c. Divides a by 3.14 and stores the result in b d. Subtracts 8 from b and stores the result in a 8. Write a pseudocode statement that assigns the sum of 10 and 14 to the variable total. 9. Write a pseudocode statement that subtracts the variable downPayment from the variable total and assigns the result to the variable due. 11. If the following pseudocode were an actual program, what would it display? Declare Integer a = 5 Declare Integer b =…show more content…
Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the total sales tax). Hint: Use the value 0.02 to represent 2 percent, and 0.04 to represent 4 percent. 9. Celsius TO Fahrenheit Temperature Converter Design a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows: F=9/5C+32 CHAPTER 3 : ALGORITHM WORKBENCH (Modules) 5. Design a module named getNumber, which uses a reference parameter variable to accept an Integer argument. The module should prompt the user to enter a number and then store the input in the reference parameter variable. 6. What will the following pseudocode program display? Module main () Declare Integer x = 1 Declare Real y = 3.4 Display x, “ “, y Call changeUS (x, y) Display x, “ “, y End Module Module changeUS (Integer a, Real b) { Set a = 0 Set b = 0 Display a, “ “, b } 7. What will the following pseudocode program display? Declare Integer x = 1 Declare Real y = 3.4 Display x, “ “, y Call changeUS (x, y) Display x, “ “, y End Module Module changeUS (Integer Ref a, Real Ref b) { Set a = 0 Set b = 0.0 Display a, “ “, b } PROGRAMMING EXERCISES (Modules) 6. Body Mass Index