Some computer fundamentals and jargon Memory: Basic element is a bit – value = 0 or 1 Collection of “n” bits is a “byte” Collection of several bytes is.

Slides:



Advertisements
Similar presentations
Integrated Business Applications with Databases (D3) Jenny Pedler
Advertisements

Single Variable and a Lot of Variables The declaration int k; float f; reserve one single integer variable called k and one single floating point variable.
Object Oriented Programming A programming concept which views programs as objects with properties and ways to manipulate the object and the properties.
The Binary Numbering Systems
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Advanced Topics Object-Oriented Programming Using C++ Second Edition 13.
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
Data types and variables
Introduction to a Programming Environment
Primitive Types Java supports two kinds of types of values – objects, and – values of primitive data types variables store – either references to objects.
Chapter 2 Data Types, Declarations, and Displays
String Escape Sequences
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Objectives You should be able to describe: Data Types
C Programming Lecture 3. The Three Stages of Compiling a Program b The preprocessor is invoked The source code is modified b The compiler itself is invoked.
A Variable is symbolic name that can be given different values. Variables are stored in particular places in the computer ‘s memory. When a variable is.
CIS Computer Programming Logic
Object Variables Visual Basic for Applications 3.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Input & Output: Console
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
Copyright © 2002 W. A. Tucker1 Chapter 7 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Number Systems Spring Semester 2013Programming and Data Structure1.
CS190/295 Programming in Python for Life Sciences: Lecture 3 Instructor: Xiaohui Xie University of California, Irvine.
1 INFORMATION IN DIGITAL DEVICES. 2 Digital Devices Most computers today are composed of digital devices. –Process electrical signals. –Can only have.
Input, Output, and Processing
Lecture #5 Introduction to C++
Data & Data Types & Simple Math Operation 1 Data and Data Type Standard I/O Simple Math operation.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
1 Data Representation Characters, Integers and Real Numbers Binary Number System Octal Number System Hexadecimal Number System Powered by DeSiaMore.
Introducing C++ Programming Lecture 3 Dr. Hebbat Allah A. Elwishy Computer & IS Assistant Professor
Visual Basic  Is the language for programming in Word, Access,& Excel  Is the “Environment” in which the programming is done (called the Integrated Development.
Copyright © – Curt Hill Types What they do.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
Chapter 7 C supports two fundamentally different kinds of numeric types: (a) integer types - whole numbers (1) signed (2) unsigned (b) floating types –
C++ Programming Lecture 3 C++ Basics – Part I The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
COP 2510 Programming ConceptsAlessio Gaspar BSAS Industrial Operations 1 Manipulating Data Concepts Covered: Literal values, variables and Types Variables.
Visual Basic Objects / Properties / Methods PropertyAdjective ObjectNoun Part of the application Attribute MethodVerb Action to do something.
CPS120: Introduction to Computer Science Variables and Constants.
CHAPTER 2 PROBLEM SOLVING USING C++ 1 C++ Programming PEG200/Saidatul Rahah.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
CS 125 Lecture 3 Martin van Bommel. Overflow In 16-bit two’s complement, what happens if we add =
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Constants, Data Types and Variables
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Programming and Data Structure
Topics Designing a Program Input, Processing, and Output
VBA - Excel VBA is Visual Basic for Applications
Number Representation
BASIC ELEMENTS OF A COMPUTER PROGRAM
Computing Fundamentals
ITEC113 Algorithms and Programming Techniques
Fundamental Data Types
C++ Data Types Data Type
Storing Negative Integers
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Topics Designing a Program Input, Processing, and Output
Fundamental Data Types
Fundamental Programming
Topics Designing a Program Input, Processing, and Output
Primitive Types and Expressions
Programming Fundamental-1
Presentation transcript:

Some computer fundamentals and jargon Memory: Basic element is a bit – value = 0 or 1 Collection of “n” bits is a “byte” Collection of several bytes is a “word”

Byte The smallest collection of bits that can hold a character. Usually 8 bits, but on some old or special computers may be 4 or fewer bits. We will assume 8 bit / byte Trivia: 4 bits in an 8 bit/byte world is called a “nibble” Number of distinctly different characters that can be held in a byte: through

Byte Two major schemes (in the US anyhow) for encoding characters: ASCII -- American Standard Code for Information Interchange Originally designed for use with teletype machines and used only 128 characters.

Byte Was limited, so extended two ways: Extensions to ASCII --- define characters to occupy values 128 – 255. Not really standardized EBCDIC (IBM) Extended Binary Coded Decimal Interchange Code

Byte Need to be aware of differences as same bit pattern gives different characters. Some computers / languages use ASCII, some use EBCDIC ASCII: o (lowercase “O”) EBCDIC: ? (Question mark) The PC uses ASCII

Word Word typically contains 4 bytes, but can be as few as two or as long as 8. IBM used 4 bytes / word and this has become the standard. Also standardized is the convention that the first bit represents the sign – 1 0

Word = = But numbers come in two flavors: Integers or whole numbers, as above Real, or floating point, numbers A 2 byte word

Word Floating point numbers are scaled to fall between -1 and +1 Bits in the word are divided to represent the sign of the number, the exponent, and the sign of the exponent * 10 5 And gets translated as:

Word Sign of Exponent ( + ) Value of Exponent (5) Sign of Number ( + ) Value of number (245050) The lead decimal point in is implied and taken care of by the computer

A couple of things to note: 1)The “numeric” part of a floating point number only has 27 bits, so is of limited precision (about 7 digits --- any thing else is garbage. 2)The exponent has 7 bits, so can range roughly from 2 –127 to ( to )

Why should you care???? When we start doing Visual Basic in Excel (VBA), will need to define the type of variable we are using. VBA recognizes several types: Byte A single byte (8 bits) of data String A sequence of bytes containing characters Int 2 byte integer Long 4 byte integer Single 4 byte real number Double 8 byte real number

Real (or floating point) numbers can be entered in a variety of ways With the decimal point: With the power of 10 (formula):=1.234*10^3 With the “E” notation (Scientific notation) 1.234e3

Characters & Stings For Excel, anything that is not a number or a formula is a string. If want a set of digits as a string, need to enclose in quote or quotation marks. For VBA, need to define variables that will hold strings as string data types As you might expect, both Excel and VBA have functions to convert strings to numbers and numbers to strings. But use with care.

Some programming concepts Computers are dumb! Will do only what you tell them Will do it very fast Will do it very accurately A “program” is a set of very explicit instructions

Some programming concepts A good analogy is developing a set of driving directions Need to be accurate Go 2.5 miles and turn right on M 40 Need to be unambiguous (clear) Turn right just after the bank on the corner Useful if can correct from error If reach the T intersection, you have gone too far

Some programming concepts Programming languages have a variety of constructs from which to build the program Assignment Statement: Variable = Variable or value Logic statement Boolean Expressions: A > B, etc. If (Boolean Expression) then …… Looping instructions For …. Next Do Until ….

Some programming concepts Need to “Declare” variable types In BASIC, declaration done as: Dim var as Type And can invoke functions and other prewritten modules Print, read, sqrt,…..

A trivial example Dim i as integer Dim A as single Dim B as single Dim S as string S = “Loop Done” A = 5. For i = 1 to 10 B = A*i if B > 20 then B = A +i end if Print B Next i Print S

A trivial example Would result in output that looks something like Loop Done

Programs usually broken into “modules” Each module does one specific set of tasks e.g. Read / verify input data Perform specific operations Prepare / print output

Modules --- two flavors Subprograms --- do not return a value Functions --- return a value e.g. Sqrt(x)

Visual Basic  Is the language for programming in Word, Access,& Excel  Is the “Environment” in which the programming is done (called the Integrated Development Environment or IDE)

Visual Basic Objects / Properties / Methods Object Property Method Noun Adjective Verb

Visual Basic Range (“A3”).select Range is an object select is a method (“A3”) is a modifier for the object Note that object separated from method by a.

Activesheet.name Activesheet is an object name is a property Visual Basic The result is the name of the active sheet

Visual Basic All objects have properties Most objects have methods Will work with only a few of the many objects, methods and properties Will introduce them as needed

Visual Basic Some of the objects Workbook Worksheet ActiveSheet Range Form Chart Note --- a “Cell” is not an object, but is a type of range object

Visual Basic And to further confuse the issue objects can have objects as properties And objects can be grouped into collections Workbook = collection of worksheets

Visual Basic -- The Environment From Excel --- toggle with alt F11 Notice 3 parts to the IDE The Project area The Properties area The blank (or work area) We will use primarily the properties and work areas

Macros are a type of VBA module “Recorded Macros” are exactly that A record of the key strokes converted to VB code

Keyboard Macros Quick way to develop a macro Captures keystrokes Assigns a name & shortcut Two places to store Current workbook Personal workbook

Current workbook Macro only available in the workbook Stays with the workbook Personal workbook Available to all workbooks you create in current session. Does not travel with current workbook Stored in a special area and needs to be opened.

Recorded keystrokes macros, if saved in current workbook, are VBA subprograms in the “modules” component of the IDE. Good way to look at how Excel is manipulated. If saved in the Personal Workbook, will see the Personal Workbook available in the IDE Project window. Are in a module of the Personal workbook

Can record macros in two modes: Absolute address mode – referenced cells are absolute addresses (i.e. $col$row) Relative address mode – referenced cells are relative to the selected cell when the macro is recorded. That is, cell addresses may change each time macro is run.

We will use recorded macros primarily as a way to introduce VBA programming. But you should be able to find a good use for them – great for repeated tasks.