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

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

View Full Document Right Arrow Icon
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.
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern