Premium Essay

Pseudo-Code Structure

In:

Submitted By akalex01
Words 765
Pages 4
Pseudo-code is an informal high-level description of the operating principle of a computer program or other algorithm. It uses the structural conventions of a programming language, but is intended for human reading rather than machine reading. Pseudo-code typically omits details that are not essential for human understanding of the algorithm. The programming language is augmented with natural language description details, were convenient, or with compact mathematical notation. The purpose of using pseudo-code is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm. Pseudo-code resembles, but should not be confused with skeleton programs, including dummy code, which can be complied without errors. Flowcharts and Unified modeling Language charts can be thought of as a graphical alternative to pseudo-code, but are more spacious on paper.
A sequence structure is represented in pseudo-code as a line of instruction. A pseudo-code statement representing sequence would typically contain text very similar to what is found within the rectangle of the flowchart. The sequence control structure simply lists the lines of pseudo-code. The concern is not with the sequence category but with selection and two of the iteration control structures. A good example is; if age greater than 17, display a massage indicating you can vote else display a message indicating you can't vote end. Below is some pseudo-code written for a program which moves a long as touch sensor is not pressed, but stops and turns to the right if its sonar detects an object less than 20in away. Task main, while (touch sensor is not pressed), Robot runs forward, if (sonar detects object less than 20in away), Robot stops, Robot turns right. This pseudo-code example includes

Similar Documents

Free Essay

Modular Programming

...algorithm by determining and writing the main tasks to be carried out as a sequence of general steps”. The third step is to “fill in more details by determining the sub-tasks, if any, for each main task. Lastly, “repeat step third step until you arrive at a precise algorithm expressed in terms of basic executable instructions.” How is pseudo-code used to assist in writing an algorithm? Pseudo-code is defined as an outline of a program written in a form that can easily be converted into real programming statements. It is sometimes confused with an algorithm when developing a program. In reviewing Prelude to Programming: Concepts and Design, Fifth Edition, (para. 2.1, pg 72 an algorithm is “a step by step method for solving a problem or doing a task.” Pseudo-code uses short and easy to understand phrases in plain English language to describe the outline of a program. Being able to use pseudo-code for an algorithm will make writing the actual code that much easier. Why is spaghetti code considered a problem? The use of the term spaghetti code leads to assumption that it is bad code. This is not necessarily the case. Spaghetti code is low-level code where everything is everywhere. What makes...

Words: 602 - Pages: 3

Premium Essay

Phase 4 Ip

...Introduction 3 PROBLEM SOLVING TECHNIQUES 4 Table 1; DATA DICTIONARY 5 DATA DICTIONARY (CONTINUE) 6 Equation 7 Expression 8 SEQUENTIAL LOGIC STRUCTURES 9 Function 1: Allow customers to check current balances 10 The Problem Analysis Chart (PAC) 10 Table 2: PAC Chart 10 Function 2: Allow Customer to Make a Remote Deposit 11 Structure Chart 11 Figure1: Structure Chart 11 Function 3: Permits Customers to Transfer Funds between Savings & Checking 12 Coupling Diagram 12 Figure 2: Coupling Diagram for Transfer 12 PROVBLEM SOLVING WITH DECISIONS 13 PSEUDO CODE 14 FLOW CHART 14 Function 1: Allows Customer to Check Current Balance 15 Figure 3: for Pseudo code=View Balances 16 Function 2: Allows Customer to Make a Remote Deposit 17 Banking e-Teller (BET) 18 18 Figure 4: Pseudo code=Remote Deposit 19 Function 3: Allows Customer to Transfer Funds between Savings and Checking 20 Banking e-Teller (BET) 21 21 Figure 5: flow charts for transfers 22 PROBLEMSOLVING WITH LOOPS 23 MODIFCATION 24 Function 3: Allows Customer to Transfer Funds between Savings and Checking 24 Figure 6: Flow chart for transfer with loop 27 CASE LOGIC STRUCTURE 28 Banking e-Teller...

Words: 2269 - Pages: 10

Premium Essay

Prg 211 Week 4

... Introduction Parallel array structures can be used for many instances where an individual wants to input information that is unique to them, such as keeping track of their value items of learning. The entire process of putting pen to paper and creating a program is methodical in nature. The code does not have to be complicated and can be written in plain spoken English. Testing a program to see if it works is a simple task. All the programmer has to do is to input the data into the program and if it is functioning properly, a result based on the input and output will appear of the screen. The results come from a calculated list of items that have a represented value declared by the programmer. For instance, if a programmer wanted to design a program to calculate an entire course’s worth of an item with high value, then they would most likely declare the item of high value as the starting declaration and then say how many of that item are in an entire course. Problem Statement and Solution Arrays have been used in a whole host of problems to arrive at solutions for daily routines and tasks that people are involved in. Parallel arrays operate on a “grab that” basis where the values within the strings grab data from each other and produce information for the user. The For Loop and data sharing elements make the structures a desirable solution to any instance where programmers need to write programs and codes for a single problem with many working...

Words: 772 - Pages: 4

Premium Essay

Personal Learning Management Array Structure

...Personal Learning Management Array Structure Giovonnte J. Tate PRG/211 March 31, 2014 Travis Sprouse Object-Oriented Programming Parallel array structures can be used for many instances where the programer wants to input information that is different to them, such as keeping track of their important items of learning. The whole process of creating a program is of a structured nature. Code does not have to be difficult and can be written in simple English. What programmers need to do is input the data into the program and if it is functioning properly, a result based on that data and output will appear. All results come from a calculated list of items that have a represented value declared by the programmer. Arrays have been used in lots of problems to arrive at solutions for tasks and routines that people are involved in day to day. The For Loop and data sharing elements make the structure a desirable solution to any situation where programmers need to write codes and programs for a problems with many working parts, such as the me with several classes with a value rating applied. The data shared between the elements, assignments and projects completed, has to be shared in order to get your results. The most logical solution is the use of a parallel array structure. To test this conclusion, a pseudo code has been written and executed and is operating with satisfactory results. The pseudo code for this particular program is written as follows: Economic Value...

Words: 675 - Pages: 3

Free Essay

Media Disadvantge

...------------------------------------------------- Note: Those who still not submitted assignment # 1, 2, 3 do submit it with assignment # 4, after that no late submission will accept. Pseudocode & Flowchart Assignment Selection Structure 1. Write pseudo-code and draw flowchart that input any number between 1 and 7 inclusive. If 1 is input, the output should be Monday, for 2 the output should be Tuesday and so on. For invalid input, message “wrong input” should be displayed. 2. Write pseudo-code and draw flowchart for a company in which an employee is paid as under: If his basic salary is less than Rs. 15000, then HRA = 10% of basic salary and DA = 90% of basic salary. If his salary is either equal to or above Rs.15000, then HRA = Rs. 5000 and DA = 98% of basic salary. If the employee’s salary is input, then find his gross salary. 3. Write pseudo-code and draw flowchart that enters the marks obtained, Homework, Assignment and Test with weight age. Home work = 0.2 Assignment = 0.3 Test = 0.5 If net marks are more than 60%, prints PASS, else FAIL. 4. Write pseudo-code and draw flowchart that reads in five integers & determines & prints the largest & the smallest integers in the group. 5. Write pseudo-code and draw flowchart that enters a year and determine whether its leap year or not....

Words: 282 - Pages: 2

Free Essay

Pt1440 Mid Term Review

...that refers to the correct data code -- syntax 5. pg. 16 name the first high level programming language to perform complex math calculations--fortran 6. pg. 14 a program that uses pneumonic -- assembly language 7. pg. 13 when a cpu is executing instructions it is in the --fetch decode and execute cycle 8. pg. 18 compared to a interpreted program a compiled program – executes faster 9. pg. 12 machine language 10101010 10. pg. 11 an encoding technique to store negative numbers—two’s complement (D) 11. pg. 30 an error that will give incorrect result but not stop the program – Logic error 12. pg. 30 there is a program development cycle has --- 5steps 13. pg. 32 informal language used to create modules of code that does not care about syntax -- pseudo code 14. pg. 32 graphical depiction of steps of a program – flow chart 15. pg. 36 a structure of statements ---sequence 16. pg. 32 what is used to represent an assignment in a flow chart – processing symbol 17. pg. 46 mathematical operator to raise a number to a power -- ^ 18. pg. 49 order of operations PEMDAS 19. pg. 56 three variable date types – real, integer, string 20. pg. 62 during program execution this cannot be changed --- named constant 21. pg. 76-77 benefit to using modules are – simpler code, faster development, code reuse 22. pg. 31 ask for pseudo code errors – proper order –input price, input quantity, set tax rate, set tax due, display tax due 23. pg.31 ask for pseudo code –student name, degree program...

Words: 682 - Pages: 3

Free Essay

Prg 210 Week 4 Paper

...Selection and Repetition Control Structures PRG 210 March 30, 2011 John Rogers Selection and Repetition Control Structures Introduction This paper reviews and explains selection control structure and repetition control structure. Selection and repetition control structures increase the ability and power of a computer programs. Selection control structure allows statement execution if a condition is true and another statement execution if a condition is false. Repetition control structure or looping is the process of repeating execution of one or more steps of an algorithm or computer program. Essentially in programming, many performed calculations have repetitious tasks. Examples of both a selection control structure statement and a repetition control structure statement identifies and helps understand the importance of available computer operations to the programmer to compare variables, select one of two actions and repeat tasks as necessary. Selection Control Structure Statement executions in programming are under the control of one statement at a time. When statements execute, control is turned over to the next statement similar to running a relay race; one runner passes the baton to the next runner until the result of the baton across the finish line. When one statement finishes executing, control passes to the next statement until the desired output calculates. Computer programs use selection control structures to choose between alternative actions...

Words: 1277 - Pages: 6

Premium Essay

Notes

...Chapter 2 Notes: 2.1: Concept: programs must be carefully designed before they are written. During the design process, programmers use tools such as pseudo code and flowcharts to create models of programs. Key terms: Logic Error: A mistake that does not prevent the programming from running, but it causes incorrect results. Debugging: finding and correcting the code that caused the error. Program Development Cycle: the process of creating, debugging, and possibly changing the original program. The steps are as follows: Design the program write the code correct syntax errors test the executable code Debug the code Repeat necessary Customer: The person, group or organization that is asking you to write a program Software Requirement: A single function that the program must perform in order to satisfy the customer Algorithm: A set of well-defined logical steps that must be taken to perform a task. It must be translated into code before it can be given to the computer. Pseudo code: “Fake Code” used to model programs Flow charts: Diagrams that that graphically depicts the steps the steps that take place in a program. There are three types of symbols in a flow chart: 1. Ovals (Appear at the top and bottom of a flow chart, and are also referred to as terminal symbols. The start terminal symbol marks the program’s starting point and the end terminal symbols marks the program’s ending point) 2. Parallelogram (Used for both input and output symbols) ...

Words: 384 - Pages: 2

Premium Essay

Study Guide

...machine language (or machine code)? Compiler What both translates and executes the instructions in a high level language program? Interpreter Rules that are strictly enforced during compilation are called what? Syntax Rules What are violations of strictly enforced rules during compilation called? Syntax Errors Which will not prevent compilation, syntax or logical errors? Logic Errors What was the first programming language designed to perform complex math functions? Fortran Instead of binary numbers, assembly language uses short words for instructions known as what? Mnemonics Name a high level language you use in the course. Visual Basic The words that make up a high level programming language are know as what? Keywords When a CPU executes instructions in a program, it is known as what? The Fetch-Decode-Execute Cycle Which runs faster a compiled or an interpreted program? Compiled Which language utilizes binary numbers like 01110000? Machine Language Which language utilizes commands like ADD A7? Assembly Language What is the method used to store negative integers into memory? Two's Compliment How many steps are in the Program Development Cycle and what are they? 1 - Design the Program 2 - Write the Code 3 - Correct Syntax Errors 4 - Test the Executable Code 5 - Debug the Code What is an informal language that has no syntax rules and is not meant to be compiled or executed? Pseudo Code What is a diagram that graphically...

Words: 1092 - Pages: 5

Free Essay

Info Tech

...2. ALGORITHMS, FLOWCHARTS, DATA TYPES AND PSEUDOCODE 2.1 ALGORITHMS The term algorithm originally referred to any computation performed via a set of rules applied to numbers written in decimal form. The word is derived from the phonetic pronunciation of the last name of Abu Ja'far Mohammed ibn Musa al-Khowarizmi, who was an Arabic mathematician who invented a set of rules for performing the four basic arithmetic operations (addition, subtraction, multiplication and division) on decimal numbers. An algorithm is a representation of a solution to a problem. If a problem can be defined as a difference between a desired situation and the current situation in which one is, then a problem solution is a procedure, or method, for transforming the current situation to the desired one. We solve many such trivial problems every day without even thinking about it, for example making breakfast, travelling to the workplace etc. But the solution to such problems requires little intellectual effort and is relatively unimportant. However, the solution of a more interesting problem of more importance usually involves stating the problem in an understandable form and communicating the solution to others. In the case where a computer is part of the means of solving the problem, a procedure, explicitly stating the steps leading to the solution, must be transmitted to the computer. This concept of problem solution and communication makes the study of algorithms important to...

Words: 4924 - Pages: 20

Free Essay

Icao Codes

...identification simple and clear. Code selections in North America were based on existing radio station identifiers. For example, radio stations in Canada were already starting with "C", so it seemed logical to begin Canadian airport identifiers with Cxxx. The United States had many pre-existing airports with established mnemonic codes. Their ICAO codes were formed simply by prepending a K to the existing codes, as half the radio station identifiers in the US began with K. Most ICAO codes outside the US and Canada have a stronger geographical structure. Most of the rest of the world could be classified in a more planned top-down manner, as they didn't have as much established aviation legacy. Thus Uxxx referred to the Soviet Union with the second letter denoting the specific region within it, and so forth. Europe had too many locations for only one starting letter, so it was split into Exxx for northern Europe and Lxxx for southern Europe. The second letter drilled down: EGxx was the United Kingdom (G for Great Britain), EDxx was West Germany (D for Deutschland), ETxx was East Germany (the ETxx code was reassigned to military fields after the reunification), LExx was Spain (E for España), LAxx was Albania, and so on. France was designated LFxx, as the counterpart EFxx was the unambiguously northern Finland. (originally OFxx, as the more rigid geographical structure evolved over time; in the beginning, countries usually had "blocks" of codes; for example, Finland still has the...

Words: 982 - Pages: 4

Premium Essay

Pt1420

... What is the term that describes the part of the program that a variable can be accessed?: Scope What is the truth table for AND?: True AND True = True True AND False = False False AND False = False False AND True = False 34. 35. 56. 36. 57. What is the truth table for OR?: True OR True = True True OR False = True False OR False = False False OR True = True 58. 59. 60. What is the value of 2^3?: 2 2 2 = 8 What is the value of 4^2?: 4 * 4 = 16 What is the value of the expression 10-4*3/2+5?: 9. Multiply first, then divide, then subtract and finally add. What is used to check the relationship between two values?: Relational Operator What is used to translate high level language programs to machine language (or machine code)?: Compiler What makes a computer useful for everyday tasks?: Application Software What was the first programming language designed to perform complex math functions?: Fortran When a CPU executes instructions in a program, it is known as what?: The Fetch-Decode-Execute Cycle When a module completes where does it return to?: Return Point from where it was called. Which flowchart symbol represents a terminal point like Start or Stop?: Oval Which flowchart symbol represents calling modules and is used with the keyword Call?: Rectangle with 2 Vertical Lines 37....

Words: 779 - Pages: 4

Free Essay

Programming

...Introduction Selection structures allow computer programs to perform different functions depending on if the condition of the function is true or false. Selection structures also enable the program to decide on a particular action based on the input of the user or other processes. There are several different types of selection structures that can be put into operation, they are the IF selection statement, the IF ELSE selection statement and switch selection statement. This paper will attempt to explain selection structure and its different types and will also give a real life scenario in pseudo code. Selection Control Structure Computer programs utilize selection structures to choose from a variety of actions or processes. These processes typically have an outcome of true or false. When a program reads as true the process will be directed to the output that enables it to be true and vice versa for false processes. With computers having the ability to solve problems, make decisions and follow direction with the aide of a program it eliminates many human errors. The “IF” selection statement structure is used when there is a solitary or a collection of inputs to be executed to decide if the condition is true or false. If a process is submitted as false the “IF else” statement is rendered and the false output is passed over and the computer continues executing to the next selection structure. The IF statement structure also compares two values with relational operators: •...

Words: 505 - Pages: 3

Premium Essay

Dna Barcoding Research Paper

...lab are 16S and CO1. The 16S rRNA is one of the most common housekeeping genetic markers used to study bacterial phylogeny and taxonomy (Janda and Abbott 2007). Barcode 16S rRNA is a major component of 30S subunit that consist of 1542 bases (Jane and Abbott 2007). 16S main structure is highly conserved. Due to the fact the 16S rRNA is highly conserved it is most commonly found in majority of bacteria (Janda and Abbott 2007). 16S rRNA gene sequence examination can enhance...

Words: 486 - Pages: 2

Free Essay

Homework 2

...Kenneth jones CMIS 102 15 February 2015 Pseudo code /* This is a pseudo code for calculating the GPA for students each registered for different no of courses */ CalculateStdntGpa (int NoStudents, int NoCourses, char StudentNames[],char CourseGrade[]) //INPUT: No of students, Name of students, No of courses and Grades for each course //OUTPUT: The GPA for each student for(int i = 0: i < NoStudents: i++){ StudentNames[i] <- StdntName; for(int j=1: j<= NoCourses: j++){ if(CourseGrade = ”A”){ GradePoint <- 4; } if(CourseGrade = ”B”){ GradePoint <- 3; } if(CourseGrade = ”C”){ GradePoint <- 2; } if(CourseGrade = ”D”){ GradePoint <- 1; } if(CourseGrade = ”F”){ GradePoint <- 0; } GradePoints[j-1] <- GradePoint; } Return GPA } 1. Analysis The following is a brief analysis of the program being built * Inputs The inputs for the program are: I. No of students which should be an integer value to hold the number of students II. Names for students which would be an array structure to hold all student names. This array would be of data type character III. No of courses for each student which is of data type integer IV. Grade for each course registered by each student...

Words: 796 - Pages: 4