PT1420 - Unit 2 Homework and Lab Assignment Unit 2 Assignment 1: Homework (material from Chapter 2of your text book) 1.) What is pseudocode? An informal language used to develop a programs design 2.) Computer programs typically perform what 3 steps. Input‚ Processing‚ and Output 3.) What 2 things must you normally specify in a variable declaration. Variable name and data type 4.) Write assignment statements that perform the following operations with the variables a‚ b‚ and c: a. Adds 2 to a and
Premium Computer programming Real number Algorithm
A. Seven (7) Sorting Schemes: 1. Bubble Sort 2. Selection Sort 3. Insertion Sort 4. Merge Sort 5. Quick Sort 6. Comb Sort 7. Shell Sort B. Definition‚ Best-Average-Worst Case & Algorithm: *DEFINITION* Bubble Sort – Sometimes incorrectly referred to as sinking sort‚ is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted‚ comparing each pair of adjacent items and swapping them if they are in the wrong
Premium
requesting service. Now that the variables are decided the process of building the array can begin. An array must have an Upper Bound. This simply means a limit for the number of times that the loop will run before the program ends. Without this set limit the program would become an infinite loop. Having an infinite loop could likely cause the program to crash in some cases‚ but it is the opinion of this writer that all that would happen in the case of this program would just mean that the user would be
Premium Telephone Computer programming Telephone exchange
used to represent Java’s equal to operator. 6. Java’s for loop is an example of a(n) counter-controlled loop. 7. When a while loop or a for loop is coded inside another while loop or for loop‚ the inner loop is called a(n) nested loop.. 8. A(n) sentinel is a special value that denotes the end of a list and is used to terminate loop processing when reading input values from a user‚ or a data file. 9. A(n) off-by-one error occurs when a loop is executed one too many‚ or one too few times due to an
Premium Subroutine Equals sign Statement
Flowcharts Control Flow Diagram—Main Control Control Flow Diagram—Display Menu Control Flow Diagram—Get_Int_Value Control Flow Diagram—Convert Currency Control Flow Diagram—Display_Results Pseudocode Main program Declare selection as integer Declare currency Type as Integer Declare International Value as Real
Premium United States dollar Currency Pound sterling
manufactures several types of candy. Design a flowchart or pseudocode for the following: a. A program that accepts a candy name (for example‚ “chocolate-covered blueberries”)‚ price per pound‚ and number of pounds sold in the average month‚ and displays the item’s data only if it is a best-selling item. Best-selling items are those that sell more than 2‚000 pounds per month. Answer: A sample solution is as follows: Pseudocode: start Declarations string name double pricePerPound
Premium Insurance Telephone
Types of loops * while * Counter-controlled * Sentinel-controlled * State-controlled * for * foreach * do…while 1. WHILE STATEMENT * Simplest and most frequently used loop * Syntax : while (conditional expression) statement(s); * Expression – sometimes called loop condition * Returns a Boolean result of true or false * No semicolon after the conditional expression * Null body→ empty bodied loop→ infinite loop
Premium Statement
CheckPoint: Programming Problems Complete the programming problems 1 and 2 as described below. DO NOT COMPLETE THE PROBLEMS FROM THE TEXT For each of the following problems‚ use the top-down modular approach when writing the pseudocode to design a suitable program to solve each problem. Be sure to include an “analysis” for each problem. Note: you need to write 2 separate programs that will handle each problem separately. That means you will also have 2 analyses. Problem 1 Design a program
Premium Problem solving Programming language Real number
8-2 5. Write a pseudocode statement that declares the variable cost so it can hold real numbers. Floating-point variable cost 6. Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0. Declare Real price=99.95 Display "the original price." Input item original price Display "price" 7. Write a pseudocode statement that assigns the value 27 to the variable count. Count:=27 8. Write a pseudocode statement that assigns
Premium Value added tax Real number Integer
Outcome 1 Outcome • Define structured programming and explain its advantages • Describe the sequence structure • Define a flowchart and describe its relationship to pseudocode • Convert flowcharts to their equivalent pseudocode • Convert pseudocode to JavaScript • Explain how programming concepts are implemented in pseudocode‚ flowcharts‚ and JavaScript Methods of Assessment Lab practical will be used to carry out these tasks‚ students will be prompted to develop programs in JavaScript. Online
Premium Education Learning Educational psychology