October 15, 2013 Welcome! We will begin shortly..

Slides:



Advertisements
Similar presentations
What Does This Program Do?
Advertisements

Chapter 1 Object-Oriented Concepts. A class consists of variables called fields together with functions called methods that act on those fields.
P1PMF Split1 QBASIC. P1PMF Split2QBasic Command Prompt Will launch the emulator DOS operating system? Press Alt + Enter to display the widescreen.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
Variables i)Numeric Variable ii)String Variable
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
C Strings. The char Data Type for Storing Characters The char data type can is used to declare a variable that can hold a single character. Examples:
CSE202: Lecture 2The Ohio State University1 Variables and C++ Data Types.
CS107 Introduction to Computer Science Loops. Instructions Pseudocode Assign values to variables using basic arithmetic operations x = 3 y = x/10 z =
Introduction to Computers and Programming Lecture 7:
More on Numerical Computation CS-2301 B-term More on Numerical Computation CS-2301, System Programming for Non-majors (Slides include materials from.
Working with the data type: char  2000 Prentice Hall, Inc. All rights reserved. Modified for use with this course. Introduction to Computers and Programming.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Adrian Ilie COMP 14 Introduction to Programming Adrian Ilie June 27, 2005.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To understand the structure of a C-language program. ❏ To write your first C.
IWBAT compare and order positive and negative numbers.
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
Agenda Review Compiling Review Data Types Integer Division Composition C++ Mathematical Functions User Input Reading: , 8.11 Homework #3.
CPS 2231 Computer Organization and Programming Instructor: Tian (Tina) Tian.
 2003 Prentice Hall, Inc. All rights reserved. 1 Introduction to C++ Programming Outline Introduction to C++ Programming A Simple Program: Printing a.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Streams Streams –Sequences of characters organized.
Chapter 9 Formatted Input/Output. Objectives In this chapter, you will learn: –To understand input and output streams. –To be able to use all print formatting.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Computer Science 111 Fundamentals of Programming I Number Systems.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
Mastering Char to ASCII AND DOING MORE RELATED STRING MANIPULATION Why VB.Net ?  The Language resembles Pseudocode - good for teaching and learning fundamentals.
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
Input, Output, and Processing
The while Loop Syntax while (condition) { statements } As long condition is true, the statements in the while loop execute.
Module 3 Fraser High School. Module 3 – Loops and Booleans import statements - random use the random.randint() function use while loop write conditional.
Strings CS303E: Elements of Computers and Programming.
Given an integer value stored in a variable, develop an algorithm to print the value to the display device. Integer Output Note that the value could be.
Copyright © Nancy Acemian 2004 For Loops-Break-Continue COMP For loop is a counter controlled loop. For loop is a pretest loop. Used when number.
1 E0001 Computers in Engineering Built in Functions.
ORDER OF CONTENT AND INSTRUCTIONS A program in its simplest form usually contains three kinds of activity:  INPUT : The program asks the user for some.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
CSE 1341 Honors Note Set 05 Professor Mark Fontenot Southern Methodist University.
Decision Structures, String Comparison, Nested Structures
Repetition. Loops Allows the same set of instructions to be used over and over again Starts with the keyword loop and ends with end loop. This will create.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Variables and Constants Objectives F To understand Identifiers, Variables, and Constants.
Road map char data type Reading –Liang 5: Chapter 2: 2.7.4; 2.9; –Liang 6: Chapter 2: 2.7.4; 2.9 –Liang 7: Chapter 2: 2.7.4; 2.9.
Special Methods in Java. Mathematical methods The Math library is extensive, has many methods that you can call to aid you in your programming. Math.pow(double.
Variables in C Topics  Naming Variables  Declaring Variables  Using Variables  The Assignment Statement Reading  Sections
CMSC 104, Version 8/061L09VariablesInC.ppt Variables in C Topics Naming Variables Declaring Variables Using Variables The Assignment Statement Reading.
Files A collection of related data treated as a unit. Two types Text
 What Does This Program Do? ACSL.  Frequently one must use or modify sections of another programmer’s code.  It is essential to be able to read and.
Input, Output and Variables GCSE Computer Science – Python.
Chapter 2 Variables and Constants. Objectives Explain the different integer variable types used in C++. Declare, name, and initialize variables. Use character.
7 - Programming 7J, K, L, M, N, O – Handling Data.
Object-Oriented Concepts
Whatcha doin'? Aims: To start using Python. To understand loops.
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Variables, Expressions, and IO
Introduction to the C Language
Decision Structures, String Comparison, Nested Structures
INPUT & OUTPUT scanf & printf.
Decision Structures, String Comparison, Nested Structures
Data Structures – 1D Lists
Chapter (3) - Looping Questions.
Introduction to Programming
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Arrays.
JavaScript: Introduction to Scripting
Introduction to Programming
Understanding Variables
Variables in C Topics Naming Variables Declaring Variables
Class code for pythonroom.com cchsp2cs
Variables and Constants
Presentation transcript:

October 15, 2013 Welcome! We will begin shortly.

Agenda Little Tidbits WDTPD?

IBM MtM: Win Free Swag! You can do it in under an hour!

IBM MtM: Win Free Swag! Detailed, step-by step instructions with screenshots

IBM MtM: Win Free Swag! Detailed, step-by step instructions with screenshots

A Video about Programming Even more reasons you should learn to code! ly-ticker/most-important-skill-21st- century html

What’s WDTPD? Given a program, describe the output given a certain input.

What’s WDTPD? INT(A) returns the largest integer not greater than A. INT(-6.5) = -7 LEFT$(A$,N) returns a string consisting of the first N characters of the string A$. LEFT(“KEVIN”,3) = “KEV”, LEFT(“KEVIN”,200) = “KEVIN” RIGHT$(A$,N) returns a string consisting of the last N characters of the string A$. MID$(A$,A,B) returns a string consisting of the B characters beginning with the A th character of A$. For example, if A$=”AMERICAN COMPUTER” then MID$(A$,7,5) would equal “AN CO”.

What’s WDTPD? LEN(A$) returns an integer representing the number of characters in the string A$. If A$ is null (A$= “”) then LEN(A$)=0. STR$(A) converts the integer A into a string. Note that an extra space will exist on the left of the string. For example, if A=123 then STR$(A)= “ 123”. VAL(A$) is the inverse to STR$. This converts the string to its numeric value. The string’s contents must form a valid number. SQR = Square Root SGN = Sign (-1 if negative, 0 if 0, 1 if positive) INPUT: Takes user input (INPUT A; PRINT A) FOR LOOPS: FOR A = 1 TO 10

What’s WDTPD? After the following program is executed, what is the final value of X? 10 X = 0 20 for K = 7 to 52 step 6 30 X = X + K 40 next K 50 end

What’s WDTPD? K takes on values of 7, 13, 19, …, 49. The loop adds these numbers together in line (8) = 548

After the following program is executed, what is the final value of B? 10 read H, R 15 data 50, B = 0 25 if H<=48 then B = B + (H-48)*2*R 35 H=48 40 rem 45 if H<=40 then B = B +(H-40)*(3/2)*R 55 H=40 60 rem 65 B = B + H*R 70 end

This program computes an employee’s weekly salary, given the hourly rate (R) and the number of hours worked in the week (H). The employee is paid his/her hourly rate for the number of hours worked, up to 40; time and a half for the overtime hours, up to 48 hours; double for all hours after 48. The following table monitors variables B and H through the program execution: LINE B H Therefore, the final value of B is 560.

After the following program is executed, what is the final value of X? (Assume that the initial value of T$ is the null string.) 10 read A$ 20 X = 0 25 for J = len(A$) to 1 step –1 30 T$ = T$ + mid$(A$,J,1) 35 next J 40 for J = 1 to len(A$) 45 if mid$(A$,J,1) = mid$(T$,J,1) then X = X+1 50 next J 55 data BANANAS 60 end

The program first stores the reverse of A$ into T$, and then counts the number of letters that are in the same position in both strings. A$ BANANAS A$ SANANAB * ** ** Those positions marked with an asterisk contribute one to the value of X. There are 5 such positions.