Presentation is loading. Please wait.

Presentation is loading. Please wait.

BTEC Unit 06 – Lesson 06 Evidencing P4 Mr C Johnston ICT Teacher www.computechedu.co.uk.

Similar presentations


Presentation on theme: "BTEC Unit 06 – Lesson 06 Evidencing P4 Mr C Johnston ICT Teacher www.computechedu.co.uk."— Presentation transcript:

1 BTEC Unit 06 – Lesson 06 Evidencing P4 Mr C Johnston ICT Teacher www.computechedu.co.uk

2 Session Objectives Understand different data types there formats and use Be able to use the correct data type for a variable storing a specific value, Understand the grading requirements of P4.

3 Data Types???

4 Data Types We know from lesson 05 that every variable needs to be assigned a data type, The data type sets the type of data which will be stored within it and the range of values it can accept and how the data will be formatted when displayed, Although data types vary from programming language to programming language most support similar ones, The next slide shows some of the data types which are supported in visual basic.

5 Visual Basic Data Types Data TypeData UseRange of Values BooleanValues that can be true or falseTrue or False ByteWhole numbers(8 bit) 0 to 255 IntegerWhole numbers(16 bit) -32,768 to +32,767 LongLarge whole numbers c + / - 2x10 9 SingleDecimal numbers (float)Up to 7 significant figures DoubleLarge decimal numbersUp to 14 significant figures CurrencyNumber formatted to 2DP DateDate and TimeVariety of date and time formats StringAny type of characterSometimes char limit VbMsgBoxResultResults of msgbox button pressesvbYes, vbNo, vbOK, vbCancel etc

6 Choosing Data Types Assigning the correct data type to a variable is important for example: Choosing a data type with a capacity to store more data than will ever be required is wasteful, Choosing a data type that is too small for the value being stored can crash the program, Text cant be stored in numerical data types however any characters can be stored in strings, Numerical data cant start in a 0 as its breaks the rules of maths learnt at primary school, If you need to perform calculations and comparison of numerical data then its cant be stored as text, If a data item is to be used in different parts of the program then its type needs to be consistent, Code can be used to change the data type of a variable e.g. cint(variable) or clng(variable) or cstr(variable)

7 Evidencing P4 P4 asks you to produce some further slides in your presentation which explain why different data types are needed and the benefits to programmers of having a range of data types to work with, Start off by explaining the different data types available and what each is used for – include some sensible examples, Think about the space occupied for each and why it might be useful compared to other types, Make a comment about which data types seem to be common in different programming languages and which are proprietary, Write a some notes which explains why it is important to choose the correct data type and some of problems if the programmer gets it wrong.

8 A written response for P4 may be appropriate, or a table with perhaps three or four columns: data type, example, space occupied and comment. The data types available may be different according to which language is chosen, however there is an expectation that learners know of the wider range of data types available, six would be sufficient. P4 – explain why different data types are needed in programs and describe the benefits of having a variety of data types available to the programmer Visual Basic Data Types: http://msdn.microsoft.com/en-us/library/47zceaw7(v=vs.80).aspx Java Data Types: http://www.tutorialspoint.com/java/java_basic_datatypes.htm C++ Data Types: http://www.tutorialspoint.com/cplusplus/cpp_data_types.htm Pascal Data Types: http://www.tutorialspoint.com/pascal/pascal_data_types.htm


Download ppt "BTEC Unit 06 – Lesson 06 Evidencing P4 Mr C Johnston ICT Teacher www.computechedu.co.uk."

Similar presentations


Ads by Google