Essay about Programming

Words: 1065
Pages: 5

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…
A person’s BMI is calculated with the following formula: BMI = Weight x 703/Height2

9. Paint Job Estimator
A painting company has estimates that foe every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $20.00 per hour for labor. Design a modular program that asks the user to enter the square feet of wall space to be painted and the price of the paint per gallon. The program should display the following data:

The number of gallons of paint required The hours of labor required The cost of the paint The labor charges The total cost of the paint job

CHAPTER 4: ALGORITHM WORKBENCH (Decision structures and Boolean Logic)

5. Design nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2.

6. Rewrite the following If-Then-Else If statement as a Select Case statement.

If selection == 1 Then Display “You selected A.” Else if selection == 2 Then Display “You selected 2.” Else If selection == 3 Then Display “You selected 3.” Else If selection == 4 Then Display “You selected 4.” Else Display “Not good with numbers, eh?” End If

10. Write an If-Then statement that sets the variable hours to 10 when the flag variable minimum is