Data Types and Structures

Slides:



Advertisements
Similar presentations
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.
Advertisements

Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Review Binary –Each digit place is a power of 2 –Any two state phenomenon can encode a binary number –The number of bits (digits) required directly relates.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
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)
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved Introduction.
Elementary Data Types Scalar Data Types Numerical Data Types Other
Introduction to a Programming Environment
1 Lab Session-III CSIT-120 Spring 2001 Revising Previous session Data input and output While loop Exercise Limits and Bounds GOTO SLIDE 13 Lab session.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Chapter Introduction to Computers and Programming 1.
A Level Computing#BristolMet Session Objectives U2#S6 MUST identify different data types used in programming aka variable types SHOULD describe each data.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Prentice Hall. All rights reserved. 1 Microsoft Office Excel Copyright © 2008 Pearson Prentice Hall. All rights reserved
 A database is a collection of data that is organized so that its contents can easily be accessed, managed, and updated. What is Database?
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
DATABASE. Computer-based filing systems Information in computer-based filing systems are stored in DATA FILES. A FILE is a collection of RELATED RECORDS.
Logical or Boolean Data stored in Boolean form can only be one of two available values. Think of a light switch – it’s on or off. Examples include: YES.
Chapter 5: Data Types (2013) Revision Candidates should be able to know: Identify different data types? Key terms: File, record, field and key field Database.
Lec 6 Data types. Variable: Its data object that is defined and named by the programmer explicitly in a program. Data Types: It’s a class of Dos together.
I Power Int 2 Computing Software Development High Level Language Constructs.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
I Power Higher Computing Software Development High Level Language Constructs.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Data Representation The storage of Text Numbers Graphics.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
 Computers are 2-state devices › Pulse – No pulse › On – Off  Represented by › 1 – 0  BINARY.
Visual Basic/ Visual Studio Brandon Large. Connecting to prior knowledge In your notes write down what the two main parts of the computer are. The “software”
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
Data Types Mr Tottman Link. Data Types Programs need to use data for calculations and for output to various devices The best programs will always use.
Nat 4/5 Computing Science Lesson 1: Binary
Nat 4/5 Computing Science Data Representation Lesson 3: Storing Text
7 - Programming 7J, K, L, M, N, O – Handling Data.
Choosing Data Types Database Administration Fundamentals
DATA TYPES.
Unit 2 Technology Systems
IGCSE 4 Cambridge Data types and arrays Computer Science Section 2
Data Types Variables are used in programs to store items of data e.g a name, a high score, an exam mark. The data stored in a variable is entered from.
Practical Office 2007 Chapter 10
Data Representation Binary Numbers Binary Addition
Microsoft Visual Basic 2005: Reloaded Second Edition
Visual Basic 6 (VB6) Data Types, And Operators
Modified from Sharon Guffy
Starter Question In your jotter write the pseudocode to take in two numbers, add them together then display the answer. Declare variables RECEIVE firstNumber.
Arrays in C.
Lesson 2: Introduction to Control programming using Labview
Arrays, For loop While loop Do while loop
IDENTIFIERS CSC 111.
Introduction to Abstract Data Types
C++ Data Types Data Type
Web DB Programming: PHP
CS285 Introduction - Visual Basic
LabVIEW.
Data Types and Data Structures
CIS16 Application Development and Programming using Visual Basic.net
Language Constructs Construct means to build or put together. Language constructs refers to those parts which make up a high level programming language.
Introduction to Data Structure
Intro to Data Structures and ADTs
B065: PROGRAMMING Variables 1.
Learning Intention I will learn how to use an array to store data in a program.
Introduction to Computer Science
Java: Variables, Input and Arrays
Data Types and Maths Programming Guides.
Arrays & Loops.
Arrays & Loops.
Chapter 3 - Binary Numbering System
Karan Thaker CS 265 Section 001
Presentation transcript:

Data Types and Structures SOFTWARE DESIGN AND DEVELOPMENT

INTRODUCTION Computer programs of all types (games, business applications, apps on your phone, bespoke systems, websites) store and manipulate data Text, whole numbers, decimal numbers and true/false

DATA TYPES AND STRUCTURES The Course Support Notes for Higher Computing Science state that you should have knowledge and understanding of the following: string numeric (integer and real values) Boolean variables 1-D arrays, records sequential files (open, create, read, write and close)

Simple Data Types BOOLEAN A BOOLEAN can have one of two values at any one time: True or False Stored using a single bit which is on (True) or off (False)

Simple Data Types CHARACTER A CHARACTER is a single character from the keyboard or other input device Stored using ASCII or Unicode

Simple Data Types INTEGER An INTEGER is a numerical value which has no decimal point An INTEGER can be positive or negative including zero e.g. 7, -89, 0, 4000 Stored using two’s compliment notation

Simple Data Types REAL A REAL is a numerical value which includes a decimal point e.g. 45.67, -89.4, 0.004 Stored using floating point notation which uses an exponent and a mantissa

Simple Data Types STRING A STRING is a collection of characters taken for example from the keyboard e.g. “Mr Ross”, “table”, www.bbc.co.uk/news, telephone number (0141 123 45678) Stored as a ‘special’ sort of array of characters

Simple Data Types: How would you store the following? Runners name Runners time Runner qualified Runners class (e.g. A, B or C) STRING REAL BOOLEAN CHARACTER

CANDY CRUSH

EBAY app

RBS APP

Activities Complete Activities 1, 2 and 3 of the Data Types and Structures Worksheet

PROGRAMMING TASK Working with a partner, complete Activity 1 of the Data Types and Structures Programs sheet.

DATA TYPES AND STRUCTURES The Course Support Notes for Higher Computing Science state that you should have knowledge and understanding of the following: string numeric (integer and real values) Boolean variables 1-D arrays, records sequential files (open, create, read, write and close)

Storing lots of data of a single type Most software applications require large amounts of data to be stored. It is not practical to give every item of data a unique variable

Storing lots of data of a single type(cont) We use a structure called an ARRAY to store a number of items of the same data type. Programs access items in an array via a single identifier and an index into the array. Array Index 0 1 2 3

DECLARING AN ARRAY IN VISUAL BASIC An array is declared in a very similar manner to a standard variable declaration Only difference is that you also specify the number of elements you want in your array

Storing lots of data of a single type(cont) Consider the following array of strings names: John Paula Kevin Andrea Ian (0) (1) (2) (3) (4) Each element in the array can be referred to using the array name with the index in brackets after the name e.g. names(1) refers to Paula names(4) refers to Ian

Storing lots of data of a single type(cont) names John Paula Kevin Andrea Ian (0) (1) (2) (3) (4) A FOR loop could be used to print out the array above FOR counter FROM 0 TO 4 DO SEND names[counter] TO DISPLAY END FOR

String (a special sort of array) A STRING is just a special sort of array A STRING is an array of CHARACTERS Some programming languages let you access the contents of a string like an array: SET newString TO “This is a string of characters” SEND newString[8] TO DISPLAY

Structured Data Types: How would you store the following? ARRAY of STRING ARRAY OF REAL ARRAY OF BOOLEAN List of runners names List of runners times List of runners who qualified

ActivitY Complete Activity 4 of the Data Types and Structures Worksheet.

Storing more than one type of related data Parallel Arrays: SET runners TO [“Fred”, “John”, “Sophie”, “Anne”, “Mike”] SET times TO [4.32, 4.56, 4.31, 5.01, 4.45] SET qualified TO [true, false, true, false, true] Sophie’s details: runners[2], times[2] and qualified[2] You could use a FOR loop to process all 5 records

DATA TYPES AND STRUCTURES The Course Support Notes for Higher Computing Science state that you should have knowledge and understanding of the following: string numeric (integer and real values) Boolean variables 1-D arrays, records sequential files (open, create, read, write and close)

Storing in a record A more intuitive way to store related data is in a record A record stores all the details of a single runner together Store all runners details in an array of records STRUCTURE runner IS RECORD {STRING name, REAL time, BOOLEAN qualified} SET runner[0] TO {name = “Fred”, time = 4.32, qualified = True} SET runner[1] TO {name = “John”, time = 4.56, qualified = False}

Activity Please complete Activity 5 of the Data Types and Structures Worksheet.

In application storage The majority, if not all, applications which you are familiar with using will contain data stored in records

In application storage (game)

ADVANTAGES OF RECORDS Records can keep data together in a structured way. When storing lists of data about a person or thing, it makes sure that the data is held together and identified as a single item in the program.

Records in VB A user defined data type:

DOT NOTATION Records use dot notation, so each element of the record is accessed by giving the record's name followed by a dot and the element of the record.

An array of records in VB

In application storage (Database)

Visual Basic setup Toolbox Error List Default File Saving Location

Create a STRUCTURE, POPULATE AND PRINT Using Visual Basic: Create a Structure to store data of the types shown below Create an array of enough size of the type of that Structure Populate the array with the following data Print the data to the screen

Write a program to store the CAMERA data in an ARRAY OF A structure and display it in a listbox

Modify the program to allow you TO change the details of an entry IN THE LIST BOX AND DISPLAY IT AGAIN TIP: YOU CAN USE LISTBOX.SELECTEDINDEX to GET THE INDEX OF THE SELECTED ITEM