Assignment 02-1

# Assignment 02-1 - Algorithm Workbench 1 Design an algorithm...

• Homework Help
• 4

This preview shows pages 1–2. Sign up to view the full content.

Algorithm Workbench 1. Design an algorithm that prompts the user to enter his or her height and stores the user’s input in a variable named height. Declare Real Height Display “What is your height?” Input Height 2. Design an algorithm that prompts the user to enter his or her favorite color and stores the user’s input in a variable named color. Declare String color Display “What is your favorite color?” Input color 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 Set b = 2+a b. Multiples b times 4 and stores the result in b Set b = b*4 c. Divides a by 3.14 and stores the result in b Set b = a/3.14 d. Subtracts 8 from b and stores the result in a Set a = b-8 4. Assume the variables result, w, x, y, and z are all integers, and that w = 5, x = 4, y = 8, and z = 2. What value will be stored in result in each of the following statements? a. Set result = x + y 12 b. Set result = z * 2 4 c. Set result = y / x 2 d. Set result = y – z 6 5. Write a pseudocode statement that declares the variable cost so it can hold real numbers.

This preview has intentionally blurred sections. Sign up to view the full version.

This is the end of the preview. Sign up to access the rest of the document.
• Spring '14

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern