Preview

4 Types of Pseudocodes

Powerful Essays
Open Document
Open Document
1519 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
4 Types of Pseudocodes
Progamming concepts | | Week 1 Pseudocode Statement ReviewThere are 4 types of pseudocode statements that we learn in Week 1:DeclareYou use Declare to tell the computer the names of variables and the types of variables. The syntax is:Declare variablename as type A variable name must begin with a letter, can include letters, numbers and the underscore. Spaces are not allowed. The variable type is based on the data that the variable will hold. For example, if the variable stores a name, then your variable is a string. If you are using currency values with dollars and cents, then you need float. If the data is whole numbers only, then you use integer.

Input

This is how information is obtained from a user. The syntax is:

Input variablename

When a user enters a value, then the variable named will contain that value.

Set

This is a statement that sets the value of a variable. The syntax is:

Set variablename = expression

To the left of the equal sign is a variable name. To the right is an expression. When the expression is evaluated, the result is placed into the variable name.

For example:Declare var1 as IntegerSet var1 = 4 //This statement sets the value of var1 to 4Set var1 = var1 * 5 //This statement takes the value of var1, which is 4, multiplies it by 5, the result is 20, then 20 is then assigned to var1WriteThis statement writes information to a user display. You can write text and variables. The syntax is:Write expressionThe expression can be text strings and/or variables. You use the + operator, which in the Write statement means concatenation, to merge strings together.For example, if you had this code:Declare var1 as IntegerSet var1 = 4Set var1 = var1 * 5 Write “The value of var1 is “ + var1The user would see this output:The value of var1 is 20 Any questions on the above, post them here. | |

Write a program that computes and displays a 15 percent tip when the price of

You May Also Find These Documents Helpful

  • Satisfactory Essays

    USA TEST PREP ANSWER MATH

    • 1491 Words
    • 6 Pages

    This is the result of solving an equation to find a value(s) for the variable(s) which make the equation true.…

    • 1491 Words
    • 6 Pages
    Satisfactory Essays
  • Good Essays

    Declares > this is the statements that declare variables, constants, and other code elements, which can then be used within that block…

    • 193 Words
    • 1 Page
    Good Essays
  • Satisfactory Essays

    PT1420 Chapter 3 Review

    • 1062 Words
    • 8 Pages

    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?…

    • 1062 Words
    • 8 Pages
    Satisfactory Essays
  • Satisfactory Essays

    4. What is a local variable? What statements are able to access a local variable?…

    • 765 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 week 2

    • 320 Words
    • 3 Pages

    A customer in a store is purchasing five items. Design a program that asks for the price of each item, and then displays the subtotal of the sale, the amount of sales tax, and the total. Assume the sales tax is 6 percent.…

    • 320 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    CS 220 – Programming w/ Data Structures: You have missed one assignment and one quiz. Your instructor has extended your assignment due date to this Sunday, April 10. Your instructor has also let you to take your Quiz # 2 during his office hours during this week. Let me know if you need additional support to study for this quiz. Your grade to date in this class is 30.2/37 81.62% B.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    12. The STO→ button stores numbers to variables. To evaluate the expression23 4 a c b + −, press 9 STO→ ALPHA MATH ENTER to store the number 9 to A. Repeat this same process if B = 2 and C = 1, then evaluate the expression by…

    • 641 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    mat540 quiz 1 review

    • 668 Words
    • 6 Pages

    ( A variable is a symbol used to represent an item that can take on any value,)…

    • 668 Words
    • 6 Pages
    Satisfactory Essays
  • Good Essays

    Excel: Control Key and Cell

    • 2429 Words
    • 10 Pages

    To divide the value of one cell by some other number, you'd use the _________ symbol…

    • 2429 Words
    • 10 Pages
    Good Essays
  • Powerful Essays

    Java Chapter 2 Quiz

    • 2047 Words
    • 9 Pages

    6. A(n) ____ is a value that is written into the code of a program.…

    • 2047 Words
    • 9 Pages
    Powerful Essays
  • Satisfactory Essays

    UNIT 2

    • 470 Words
    • 3 Pages

    4.) Write assignment statements that perform the following operations with the variables a, b, and c:…

    • 470 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    1) You can call the module several times instead of writing it out each time.…

    • 1580 Words
    • 11 Pages
    Better Essays
  • Powerful Essays

    10. Write a pseudocode statement that multiplies the variable subtotal by 0.15 and assigns the…

    • 748 Words
    • 3 Pages
    Powerful Essays
  • Satisfactory Essays

    Lab 3 Student

    • 1264 Words
    • 7 Pages

    This lab requires you to think about the steps that take place in a program by writing pseudocode. Read the following program prior to completing the lab.…

    • 1264 Words
    • 7 Pages
    Satisfactory Essays
  • Powerful Essays

    It 210

    • 2960 Words
    • 12 Pages

    Although the value of a variable may change during execution of a program, in all our programs so far, a single value has been associated with each variable name at any given time. In this chapter, we will discuss the concept of an array—a collection of variables of the same type and referenced by the same name. We will discuss one-dimensional arrays (lists) at length and focus briefly on twodimensional arrays (tables). You will learn how to set up and use arrays to accomplish various tasks.…

    • 2960 Words
    • 12 Pages
    Powerful Essays