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

  • Better Essays

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

    • 1580 Words
    • 11 Pages
    Better Essays
  • Satisfactory Essays

    unit 3

    • 313 Words
    • 2 Pages

    6. Write a pseudocode statement that declares the variable total so it can hold real integers. Initialize the variable with the value 0.…

    • 313 Words
    • 2 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

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

    • 765 Words
    • 5 Pages
    Satisfactory 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

    1.) What is pseudocode? A.) Pseudocode is when you pre write a program in your own type of language to lay it out…

    • 453 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    CPT Coding

    • 267 Words
    • 1 Page

    Write a 250- to 350-word response in which you assume you are a medical office manager who wants to make the coding process easier for employees to understand. To facilitate a better understanding of this process, respond to the following:…

    • 267 Words
    • 1 Page
    Satisfactory 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
  • Good Essays

    5. What distinguishes a Loop control construct from a While control construct, in terms of what is known about the number of times the block of code will be repeated?…

    • 610 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Assignment

    • 1058 Words
    • 5 Pages

    1) Initialization: the variable is initialized 2) Test: the loop tests the variable by comparing it to the maximum value 3) Increment: to increase the value during each iteration the loop increments the counter variable by adding 1 to it.…

    • 1058 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    The variable can be more than one number.. as long as the statement is true…

    • 351 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Macro Examples

    • 1120 Words
    • 5 Pages

    7. The If…Then…Else…End If code allows code to be conditionally executed depending on whether a specified logical condition has been met.…

    • 1120 Words
    • 5 Pages
    Good 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
  • 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
  • Good Essays

    Unit 16 Ao1

    • 529 Words
    • 3 Pages

    Programs need to store data at some time during the execution of processes. Data is held in variables which are names containers for each piece of data. Each variable must be given a name so it can be referred to again and again throughout the program. It should be something that is recognisable because for example variable 1 would be soon forgotten in a substantial piece of code. Variable names cannot be the same as code words such as print or run.…

    • 529 Words
    • 3 Pages
    Good Essays