Defining The Problem & Planning Software Solutions <ul><li>Data Types </li></ul>
Syllabus <ul><li>Data Types </li></ul><ul><li>Data types used in solutions including: </li></ul><ul><ul><li>Integer </li><...
Why are they needed? 3 2 1
Hi I am going to tell you about why computers require data types and data structures.
INPUT Firstly, when we use a computer that is classified as INPUT.
This raw rata is converted into binary – machine code via the electronic signals on the computers keyboard.
As you know this information needs to be processed so information can be generated and OUTPUTTED.
However, this data must be stored in similar categories for processing.
A B C 1 55 7 8 90 22/3/80 $22.00 All the data is filtered into categories for storage and subsequent processing. Integer C...
So therefore we need data types to organise data for processing.
Examples of Data DATA
How is data stored? <ul><li>Data is stored as either a  constant  or a  variable. </li></ul><ul><li>Current practices requ...
How is data stored? 1001 1002 1003 1004 1005 Computer -  Store 10 in 1001 Programmer –  Num1 = 10 10 Num1
How is data stored? 1001 1002 1003 1004 1005 Computer -  Store 12 in 1002 Programmer –  Num2 = 12 10 12 Num2
How is data stored? 1001 1002 1003 1004 1005 Computer –  ADD 1001 to 1002 and STORE in 1003 Programmer –  Total = Num1 + N...
Number Representation <ul><li>Data is raw facts entered into a computer. </li></ul><ul><li>Examples include: </li></ul><ul...
Binary Number System <ul><li>Basically, every piece of data can be represented by a series of bits  (0 and 1) </li></ul><u...
Binary Number System Number 1 0 1 1 1 Binary Place 2  4 2  3 2  2 2  1 2  0 Binary Place Value 16 8 4 2 1 Binary Calculati...
Octal Number System <ul><li>Basically, every piece of data can be represented by a series of digits  (0, 1, 2, 3, 4, 5, 6,...
Octal Number System Number 3 4 5 2 1 Octal Place 8  4 8  3 8  2 8  1 8  0 Octal Place Value 4 096 512 64 8 1 Octal Calcula...
Hexadecimal Number System <ul><li>Basically, every piece of data can be represented by a series of digits  (0, 1, 2, 3, 4,...
Hexadecimal Number System Number 1 2 4 A C Hex Place 16  4 16  3 16  2 16  1 16  0 Hex Place Value 65 536 4 096 256 16 1 H...
Activity 1 <ul><li>Discussion </li></ul><ul><li>Binary Numbers are different for humans to comprehend. Why do you think oc...
Activity 2 <ul><li>Convert the following binary numbers into decimal: </li></ul><ul><ul><li>1110 </li></ul></ul><ul><ul><l...
Activity 3 Decimal Binary Octal Hexadecimal 45 10 1010111 2 75 8 3FC 16
Data Types <ul><li>The following are examples of common data types used: </li></ul><ul><li>Integers </li></ul><ul><li>Floa...
Activity 4 DATA TYPE DESCRIPTION EXAMPLES Integer 5 0 -4 87 Floating Point 2.764 -67665.3 2.3 x 10 8 String Cat Daggy2 Egg...
Variables and Constants <ul><li>A variable is a meaningful name given to something stored in memory that changes </li></ul...
Naming Variables <ul><li>The variable name should reflect the data it contains ie Name, Age, Address </li></ul><ul><li>The...
Activity 5 <ul><li>Analyse the script below and highlight 1 constant and 2 variables. Identify the data types of the const...
Homework <ul><li>Set 4B </li></ul><ul><li>Q1-10, 11, 12 </li></ul>
Upcoming SlideShare
Loading in …5
×

Data types

1,225 views

Published on

Published in: Education, Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,225
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Data types

  1. 1. Defining The Problem & Planning Software Solutions <ul><li>Data Types </li></ul>
  2. 2. Syllabus <ul><li>Data Types </li></ul><ul><li>Data types used in solutions including: </li></ul><ul><ul><li>Integer </li></ul></ul><ul><ul><li>String </li></ul></ul><ul><ul><li>Floating Point </li></ul></ul><ul><ul><li>Boolean </li></ul></ul><ul><ul><li>Date and Currency </li></ul></ul>
  3. 3. Why are they needed? 3 2 1
  4. 4. Hi I am going to tell you about why computers require data types and data structures.
  5. 5. INPUT Firstly, when we use a computer that is classified as INPUT.
  6. 6. This raw rata is converted into binary – machine code via the electronic signals on the computers keyboard.
  7. 7. As you know this information needs to be processed so information can be generated and OUTPUTTED.
  8. 8. However, this data must be stored in similar categories for processing.
  9. 9. A B C 1 55 7 8 90 22/3/80 $22.00 All the data is filtered into categories for storage and subsequent processing. Integer Character String Date
  10. 10. So therefore we need data types to organise data for processing.
  11. 11. Examples of Data DATA
  12. 12. How is data stored? <ul><li>Data is stored as either a constant or a variable. </li></ul><ul><li>Current practices requires the use of symbolic names for the programmer i.e. Name, age NOT X, Y, Z. </li></ul><ul><li>However, each storage location has a memory address for the hardware to use. </li></ul>
  13. 13. How is data stored? 1001 1002 1003 1004 1005 Computer - Store 10 in 1001 Programmer – Num1 = 10 10 Num1
  14. 14. How is data stored? 1001 1002 1003 1004 1005 Computer - Store 12 in 1002 Programmer – Num2 = 12 10 12 Num2
  15. 15. How is data stored? 1001 1002 1003 1004 1005 Computer – ADD 1001 to 1002 and STORE in 1003 Programmer – Total = Num1 + Num2 10 12 22 Total
  16. 16. Number Representation <ul><li>Data is raw facts entered into a computer. </li></ul><ul><li>Examples include: </li></ul><ul><ul><li>Words </li></ul></ul><ul><ul><li>Numbers </li></ul></ul><ul><ul><li>Dates </li></ul></ul><ul><ul><li>Images </li></ul></ul><ul><li>Regardless which data type is entered, the data can only be processed by the computer, if it is in BINARY </li></ul>
  17. 17. Binary Number System <ul><li>Basically, every piece of data can be represented by a series of bits (0 and 1) </li></ul><ul><li>Like the switches in electricity (off or on) </li></ul><ul><li>Binary is usually written in sets of 8 bits </li></ul><ul><li>Like decimal numbers, each place in binary is equivalent to a value </li></ul>
  18. 18. Binary Number System Number 1 0 1 1 1 Binary Place 2 4 2 3 2 2 2 1 2 0 Binary Place Value 16 8 4 2 1 Binary Calculation 1 x 2 4 0 x 2 3 1 x 2 2 1 x 2 1 1 x 2 0 Binary Value 16 0 4 2 1 Binary Total = 16 + 4 + 2 + 1 = 23
  19. 19. Octal Number System <ul><li>Basically, every piece of data can be represented by a series of digits (0, 1, 2, 3, 4, 5, 6, 7) </li></ul><ul><li>Like decimal numbers, each place in octal is equivalent to a value </li></ul>
  20. 20. Octal Number System Number 3 4 5 2 1 Octal Place 8 4 8 3 8 2 8 1 8 0 Octal Place Value 4 096 512 64 8 1 Octal Calculation 3 x 8 4 4 x 8 3 5 x 8 2 2 x 8 1 1 x 8 0 Octal Value 12 288 2 048 320 16 1 Octal Total = 12 288 + 2 048 + 320 + 16 + 1 = 14 673
  21. 21. Hexadecimal Number System <ul><li>Basically, every piece of data can be represented by a series of digits (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F) </li></ul><ul><li>Like decimal numbers, each place in hexadecimal is equivalent to a value </li></ul>
  22. 22. Hexadecimal Number System Number 1 2 4 A C Hex Place 16 4 16 3 16 2 16 1 16 0 Hex Place Value 65 536 4 096 256 16 1 Hex Calculation 1 x 16 4 2 x 16 3 4 x 16 2 10 x 16 1 12 x 16 0 Hex Value 65 536 8 192 1 024 160 12 Hex Total = 65 536 + 8 192 + 1 024 + 160 + 12 = 74 924
  23. 23. Activity 1 <ul><li>Discussion </li></ul><ul><li>Binary Numbers are different for humans to comprehend. Why do you think octal and hexadecimal are preferred options. </li></ul>
  24. 24. Activity 2 <ul><li>Convert the following binary numbers into decimal: </li></ul><ul><ul><li>1110 </li></ul></ul><ul><ul><li>1001 </li></ul></ul><ul><ul><li>110011100110 </li></ul></ul><ul><ul><li>110011111100 </li></ul></ul><ul><li>Convert the following decimal numbers into binary: </li></ul><ul><ul><li>32 </li></ul></ul><ul><ul><li>68 </li></ul></ul><ul><ul><li>1566 </li></ul></ul><ul><ul><li>9999 </li></ul></ul>
  25. 25. Activity 3 Decimal Binary Octal Hexadecimal 45 10 1010111 2 75 8 3FC 16
  26. 26. Data Types <ul><li>The following are examples of common data types used: </li></ul><ul><li>Integers </li></ul><ul><li>Floating Point </li></ul><ul><li>String </li></ul><ul><li>Boolean </li></ul><ul><li>Date and Times </li></ul><ul><li>Currency </li></ul>
  27. 27. Activity 4 DATA TYPE DESCRIPTION EXAMPLES Integer 5 0 -4 87 Floating Point 2.764 -67665.3 2.3 x 10 8 String Cat Daggy2 Eggplant Boolean True False Yes No Date 16/1/2006 4 th June 2001 Currency $5.84 -$58.97 $1005.46
  28. 28. Variables and Constants <ul><li>A variable is a meaningful name given to something stored in memory that changes </li></ul><ul><li>The opposite to a variable is a CONSTANT </li></ul><ul><li>Example: </li></ul><ul><ul><li>Adding up the cost of 10 items, bought at the shops. The value called Total changes as each items cost is added. Total is therefore a variable. </li></ul></ul><ul><ul><li>Calculating the value of the GST. We know that GST Percentage is always 10% of the total. This makes GST Percentage a constant and the GST Value a variable. </li></ul></ul>
  29. 29. Naming Variables <ul><li>The variable name should reflect the data it contains ie Name, Age, Address </li></ul><ul><li>The variable should always be written as 1 word. If the name is more than 1 word, show each new word with a capital letter ie FirstName, DateOfBirth </li></ul><ul><li>Most programming languages require variables to be declared and initialised (set to 0) </li></ul><ul><li>Hungarian notation dictates that each variable is prefixed with a mnemonic indicating what data type the variable holds ie intAge says that the variable is an integer that holds the age of the person while strName says that the variable is a string that holds the name of the person </li></ul>
  30. 30. Activity 5 <ul><li>Analyse the script below and highlight 1 constant and 2 variables. Identify the data types of the constant and variables. </li></ul><ul><li>BEGIN </li></ul><ul><li>Get Max </li></ul><ul><li>Repeat </li></ul><ul><li>Get Age </li></ul><ul><li>IF Age < Max then </li></ul><ul><li>Access = False </li></ul><ul><li>ELSE </li></ul><ul><li>Access = True </li></ul><ul><li>ENDIF </li></ul><ul><li>Print Access </li></ul><ul><li>UNTIL Age > Max </li></ul><ul><li>END </li></ul>
  31. 31. Homework <ul><li>Set 4B </li></ul><ul><li>Q1-10, 11, 12 </li></ul>

×