Difference between revisions of "Java/C2/Numerical-Datatypes/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
 
 
{| border=1
 
{| border=1
|| Time
+
|| '''Time'''
|| Narration
+
|| '''Narration'''
  
 
|-
 
|-
 
| 00:01
 
| 00:01
| Welcome to the spoken tutorial on '''Numerical Datatypes in Java'''.
+
| Welcome to the spoken tutorial on '''Numerical Data types''' in '''Java'''.
  
 
|-
 
|-
Line 15: Line 13:
 
|-
 
|-
 
| 00:10
 
| 00:10
|The various '''Numerical Datatypes '''available in '''Java''' and
+
| The various '''Numerical Data types ''' available in Java and
 
|-
 
|-
 
| 00:13
 
| 00:13
| How to use them to '''store numerical data.'''
+
|How to use them to '''store''' '''numerical data.'''
 
+
 
+
  
 
|-
 
|-
 
| 00:18
 
| 00:18
| For this tutorial we are using  
+
| For this tutorial, we are using '''Ubuntu 11.10''', '''JDK 1.6''' and '''Eclipse 3.7'''.
 
+
* '''Ubuntu 11.10''',  
+
* '''JDK 1.6''' and  
+
* '''Eclipse 3.7.0'''
+
 
+
 
+
  
 
|-
 
|-
 
|  00:27
 
|  00:27
|  To follow this tutorial, you must '''know how to write and run a simple java program in Eclipse'''.
+
|  To follow this tutorial, you must know how to write and '''run''' a simple java program in '''Eclipse'''.
 
+
  
 
|-
 
|-
 
| 00:34
 
| 00:34
| If not, for relevant tutorial please visit our website as shown
+
| If not, for relevant tutorials, please visit our website as shown.
 
+
 
+
 
+
  
 
|-
 
|-
 
| 00:42
 
| 00:42
|  The data type used to store integers is called '''int'''
+
|  The data type used to store integers is called '''int'''.
 
+
  
 
|-
 
|-
 
| 00:47
 
| 00:47
 
| The data type used to store decimal numbers is called '''float.'''
 
| The data type used to store decimal numbers is called '''float.'''
 
  
 
|-
 
|-
 
| 00:52
 
| 00:52
| Let us define and use integers first.
+
| Let us define and use '''integers''' first.
  
 
|-
 
|-
 
|  01:02
 
|  01:02
| Here, we have the Eclipse IDE and the skeleton required for the rest of the code.
+
| Here, we have the 'Eclipse IDE' and the skeleton required for the rest of the code.
  
 
|-
 
|-
 
|  01:10
 
|  01:10
| We have created a class '''NumericalData'''  and  added the main method to it.  
+
| We have created a '''class''' '''NumericalData'''  and  added the '''main method''' to it.  
 
+
  
 
|-
 
|-
 
| 01:15
 
| 01:15
| Now let us see how to store a number.
+
| Now, let us see how to store a number.
  
 
|-
 
|-
 
| 01:20
 
| 01:20
|   '''int distance''' ''equal to '''''28'''
+
| '''int distance''' equal to '''28''';
 
+
  
 
|-
 
|-
 
| 01:27
 
| 01:27
| This statement stores the integer value in the name '''distance.'''
+
| This statement stores the '''integer''' value in the name '''distance.'''
  
 
|-
 
|-
 
|  01:33
 
|  01:33
|   The name '''distance''' is called  an integer variable.
+
| The name '''distance''' is called  an '''integer variable'''.
 
+
  
 
|-
 
|-
Line 91: Line 72:
 
|-
 
|-
 
| 01:47
 
| 01:47
| '''System '''''dot '''''out '''''dot '''''println. In parentheses '''distance.'''
+
| '''System''' dot '''out''' dot '''println''' in parentheses '''distance''';
 
+
  
 
|-
 
|-
 
| 02:01
 
| 02:01
| This statement prints the value of the variable '''distance'''
+
| This statement prints the value of the variable '''distance'''.
  
 
|-
 
|-
 
| 02:06
 
| 02:06
|   '''Save''' the file and '''Run''' it   
+
| '''Save''' the file and '''Run''' it.  
  
 
|-
 
|-
 
| 02:14  
 
| 02:14  
|  We can see that the value ''' 28''' has been stored in distance and it has been printed.
+
|  We can see that the value '''28''' has been stored in '''distance''' and it has been printed.
 
+
  
 
|-
 
|-
Line 113: Line 92:
 
|-
 
|-
 
| 02:25
 
| 02:25
| change '''28''' to '''24'''
+
| change '''28''' to '''24'''.
 
+
 
+
 
+
  
 
|-
 
|-
 
|  02:29
 
|  02:29
|   '''Save''' and '''Run'''
+
| '''Save''' and '''Run'''.
  
 
|-
 
|-
Line 128: Line 104:
 
|-
 
|-
 
| 02:39
 
| 02:39
|'''int '''can also store negative values.
+
|'''int''' can also store negative values.
 
+
  
 
|-
 
|-
 
| 02:42
 
| 02:42
| Change 24 to ''minus'' 25
+
| Change '''24''' to minus 25 (-25).
 
+
 
+
 
+
  
 
|-
 
|-
 
|  02:48
 
|  02:48
| | '''Save''' and '''Run ''''.
+
| '''Save''' and '''Run'''.
  
 
|-
 
|-
Line 148: Line 120:
 
|-
 
|-
 
|  03:02
 
|  03:02
|  The Data type '''int '''is enough for most of our programming needs.
+
|  The data type '''int''' is enough for most of our programming needs.
 
+
  
 
|-
 
|-
 
| 03:06  
 
| 03:06  
 
| But it can only store values up to a limit.
 
| But it can only store values up to a limit.
 
  
 
|-
 
|-
Line 162: Line 132:
 
|-
 
|-
 
|  03:25
 
|  03:25
|  As we can see, there is a '''red line''' below the number which indicates an''' error'''.
+
|  As we can see, there is a red line below the number which indicates an''' error'''.
  
 
|-
 
|-
 
| 03:34
 
| 03:34
|  The error message says,the number is out of range for a variable of the type '''int'''
+
|  The error message says: the number is out of range for a variable of the type '''int'''.
 
+
  
 
|-
 
|-
 
| 03:42
 
| 03:42
| '''int '''takes 32 bits of memory and can store values only from''' -2 power 31 to 2 power 31'''.
+
| '''int''' takes '''32 bits''' of memory and can store values only from '''-2 power 31''' to '''2 power 31'''.
  
 
|-
 
|-
 
|  03:49
 
|  03:49
 
| To store large numbers, Java provides the '''long''' data type.
 
| To store large numbers, Java provides the '''long''' data type.
 
  
 
|-
 
|-
 
| 03:54
 
| 03:54
| Let us use it to store a large value.
+
| Let us use it to store a large value.
  
 
|-
 
|-
 
| 03:59
 
| 03:59
|  Change   '''int '''to '''long''' and  
+
|  Change '''int''' to '''long''' and  
  
 
|-
 
|-
 
| 04:04
 
| 04:04
 
| add a capital '''L''' at the end of the number.
 
| add a capital '''L''' at the end of the number.
 
  
 
|-
 
|-
 
| 04:11
 
| 04:11
| Save it with''' Ctrl, S'''
+
| Save it with '''Ctrl, S'''.
 
+
  
 
|-
 
|-
 
| 04:16
 
| 04:16
 
| We see that now there is no error.
 
| We see that now there is no error.
 
  
 
|-
 
|-
 
| 04:19
 
| 04:19
| Let us run it with '''Ctrl, F11'''. The value has been printed
+
| Let us run it with '''Ctrl, F11'''. The value has been printed.
 
+
  
 
|-
 
|-
 
| 04:27
 
| 04:27
| We can see that large numbers can be stored in a long variable.
+
| We can see that large numbers can be stored in a '''long''' '''variable'''.
  
 
|-
 
|-
 
|  04:32
 
|  04:32
| Now let us store a decimal number in a '''int '''variable.
+
| Now, let us store a decimal number in a '''int''' variable.
 
+
  
 
|-
 
|-
 
| 04:37
 
| 04:37
| Change '''long '''to '''int '''and change the number to '''23.5;'''
+
| Change '''long''' to '''int''' and change the number to '''23.5''';
  
 
|-
 
|-
 
|  04:50
 
|  04:50
|  As we can see, there is an error. That is because '''int '''can only store integers.
+
|  As we can see, there is an error. That is because '''int''' can only store integers.
 
+
  
 
|-
 
|-
Line 231: Line 193:
 
| 05:05
 
| 05:05
 
| change the data type to '''float.'''
 
| change the data type to '''float.'''
 
  
 
|-
 
|-
 
| 05:10   
 
| 05:10   
| And add an '''f''' at the end of the value.
+
| And add an '''f''' at the end of the value;
  
 
|-
 
|-
 
| 05:17
 
| 05:17
| save it.
+
| '''Save''' it.
 
+
  
 
|-
 
|-
 
| 05:19
 
| 05:19
 
| We see that now their is no error.
 
| We see that now their is no error.
 
  
 
|-
 
|-
 
| 05:22
 
| 05:22
| run it with''' Control F11'''
+
| '''Run''' it with '''Control F11'''.
  
 
|-
 
|-
Line 257: Line 216:
 
|-
 
|-
 
| 05:37
 
| 05:37
| Now let us change the value of  the variable distance  
+
| Now, let us change the value of  the variable '''distance'''.
 
+
  
 
|-
 
|-
Line 266: Line 224:
 
|-
 
|-
 
|  05:53
 
|  05:53
| '''Save''' it  and''' Run''' it
+
|'''Save''' it  and '''Run''' it.
 
+
 
+
 
   
 
   
 
|-
 
|-
 
| 06:01
 
| 06:01
|  we  see, that  the  output is   little different from what has been stored.  
+
|  we  see that  the  output is little different from what has been stored.  
 
+
  
 
|-
 
|-
 
| 06:06
 
| 06:06
| This happens because there is a limit to the precision of a floating point number.
+
| This happens because there is a limit to the precision of a '''floating point''' number.
 
+
  
 
|-
 
|-
Line 287: Line 241:
 
|  06:18
 
|  06:18
 
|  Now let us see the naming rules for variables.
 
|  Now let us see the naming rules for variables.
 
  
 
|-
 
|-
 
| 06:23
 
| 06:23
 
| Add a number '''2''' before the name.
 
| Add a number '''2''' before the name.
 
  
 
|-
 
|-
 
| 06:30
 
| 06:30
|  we see that, there is a '''syntax error.'''  
+
|  we see that there is a '''syntax error.'''  
 
+
  
 
|-
 
|-
 
| 06:34
 
| 06:34
 
| This is because a variable name must only start with an '''alphabet''' or an '''underscore'''.
 
| This is because a variable name must only start with an '''alphabet''' or an '''underscore'''.
 
  
 
|-
 
|-
 
| 06:40
 
| 06:40
| But generally underscore is not used to start a variable name.
+
| But generally 'underscore' is not used to start a variable name.
  
 
|-
 
|-
 
| 06:45
 
| 06:45
| Now let us add '''the number '''  at the end of the variable name.
+
| Now, let us add the number at the end of the variable name.
 
+
  
 
|-
 
|-
 
| 06:55
 
| 06:55
| We see that, there is no error.
+
| We see that there is no error.
 
+
  
 
|-
 
|-
Line 323: Line 271:
 
|-
 
|-
 
|  07:04
 
|  07:04
|  Now add an  ''''underscore'''' in the middle of the name
+
|  Now add an  'underscore' in the middle of the name,
  
 
|-
 
|-
 
| 07:15
 
| 07:15
|  we   see that there is no error.
+
|  we see that there is no error
 
+
  
 
|-
 
|-
 
| 07:17
 
| 07:17
| Which means an underscore is permitted  in a variable name.
+
| which means an 'underscore' is permitted  in a variable name.
 
+
  
 
|-
 
|-
 
| 07:22
 
| 07:22
| But any other''' punctuation''' in a variable name that give an syntax error or other errors.
+
| But any other '''punctuation''' in a variable name might give a syntax error or other errors.
 
+
  
 
|-
 
|-
Line 345: Line 290:
  
 
|-
 
|-
|     07:35
+
| 07:35
| | This brings us to the end of the tutorial.  
+
|This brings us to the end of the tutorial.  
  
 
|-
 
|-
 
|07:38     
 
|07:38     
|In this tutorial we have learnt about the various '''numerical datatypes.'''  
+
|In this tutorial, we have learnt about the various '''numerical data types'''  
  
 
|-
 
|-
 
|  07:44   
 
|  07:44   
|And How tostore    '''numerical data. '''
+
|and how to store numerical data.
  
 
|-
 
|-
 
| 07:46
 
| 07:46
|And We have also learnt the '''rules for naming a variable'''.
+
|And we have also learnt the rules for naming a variable.
  
 
|-
 
|-
 
| 07:51
 
| 07:51
 
|  As an assignment for this tutorial,  
 
|  As an assignment for this tutorial,  
 
  
 
|-
 
|-
|     07:53
+
| 07:53
|Read about other numerical data types and  
+
|read about other numerical data types and  
  
 
|-
 
|-
|     07:56
+
| 07:56
|see how they are different from int and float.
+
|see how they are different from '''int''' and '''float'''.
 
+
  
 
|-
 
|-
Line 380: Line 323:
 
|-
 
|-
 
| 08:05      
 
| 08:05      
|To know more about the '''Spoken Tutorial''' project, watch the video available at the following link.  [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial ]  
+
|To know more about the Spoken Tutorial project, watch the video available at the following link.  [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial]  
  
 
|-
 
|-
 
| 08:11     
 
| 08:11     
| It summarises the Spoken Tutorial project
+
| It summarizes the Spoken Tutorial project.
  
 
|-
 
|-
 
| 08:14     
 
| 08:14     
| If you do not have good bandwidth, you can download and watch it
+
| If you do not have good bandwidth, you can download and watch it.
 
+
 
    
 
    
 
|-
 
|-
 
|  08:20
 
|  08:20
| The Spoken Tutorial Project Team. Conducts workshops using '''spoken tutorials'''.
+
| The Spoken Tutorial Project team: conducts workshops using '''spoken tutorials'''.
 
+
  
 
|-
 
|-
 
|  08:24   
 
|  08:24   
|Gives certificates to those who pass an online test. For more details, please write to '''contact AT spoken HYPHEN tutorial DOT org.'''
+
|Gives certificates to those who pass an online test. For more details, please write to '''contact AT spoken HYPHEN tutorial DOT org.'''
  
 
|-
 
|-
 
| 08:35
 
| 08:35
'''Spoken Tutorial '''Project is a part of the '''Talk to a Teacher''' project.
+
|  Spoken Tutorial Project is a part of the Talk to a Teacher project.
 
+
  
 
|-
 
|-
 
|  08:39   
 
|  08:39   
|It supported by the '''National Mission on Education through ICT, MHRD, Government of India. '''
+
|It supported by the National Mission on Education through ICT, MHRD, Government of India.
 
+
  
 
|-
 
|-
 
|  08:45   
 
|  08:45   
|More information on this Mission is available at the following link.
+
|More information on this mission is available at the following link.
  
 
|-
 
|-
 
|  08:51
 
|  08:51
 
|  This tutorial has been contributed by '''TalentSprint'''. Thanks for joining.
 
|  This tutorial has been contributed by '''TalentSprint'''. Thanks for joining.
 
 
 
  
 
|}
 
|}

Latest revision as of 12:55, 28 March 2017

Time Narration
00:01 Welcome to the spoken tutorial on Numerical Data types in Java.
00:07 In this tutorial, we will learn about:
00:10 The various Numerical Data types available in Java and
00:13 How to use them to store numerical data.
00:18 For this tutorial, we are using Ubuntu 11.10, JDK 1.6 and Eclipse 3.7.
00:27 To follow this tutorial, you must know how to write and run a simple java program in Eclipse.
00:34 If not, for relevant tutorials, please visit our website as shown.
00:42 The data type used to store integers is called int.
00:47 The data type used to store decimal numbers is called float.
00:52 Let us define and use integers first.
01:02 Here, we have the 'Eclipse IDE' and the skeleton required for the rest of the code.
01:10 We have created a class NumericalData and added the main method to it.
01:15 Now, let us see how to store a number.
01:20 int distance equal to 28;
01:27 This statement stores the integer value in the name distance.
01:33 The name distance is called an integer variable.
01:37 Now we shall use the variable distance to print the value stored in it.
01:47 System dot out dot println in parentheses distance;
02:01 This statement prints the value of the variable distance.
02:06 Save the file and Run it.
02:14 We can see that the value 28 has been stored in distance and it has been printed.
02:21 Now let us change the value stored in the variable.
02:25 change 28 to 24.
02:29 Save and Run.
02:34 We see that the output has changed accordingly.
02:39 int can also store negative values.
02:42 Change 24 to minus 25 (-25).
02:48 Save and Run.
02:56 As we can see, even negative values can be stored in variables of the type int.
03:02 The data type int is enough for most of our programming needs.
03:06 But it can only store values up to a limit.
03:10 Let us try to store a large value and see what happens.
03:25 As we can see, there is a red line below the number which indicates an error.
03:34 The error message says: the number is out of range for a variable of the type int.
03:42 int takes 32 bits of memory and can store values only from -2 power 31 to 2 power 31.
03:49 To store large numbers, Java provides the long data type.
03:54 Let us use it to store a large value.
03:59 Change int to long and
04:04 add a capital L at the end of the number.
04:11 Save it with Ctrl, S.
04:16 We see that now there is no error.
04:19 Let us run it with Ctrl, F11. The value has been printed.
04:27 We can see that large numbers can be stored in a long variable.
04:32 Now, let us store a decimal number in a int variable.
04:37 Change long to int and change the number to 23.5;
04:50 As we can see, there is an error. That is because int can only store integers.
05:00 To store decimal numbers, we have to use float.
05:05 change the data type to float.
05:10 And add an f at the end of the value;
05:17 Save it.
05:19 We see that now their is no error.
05:22 Run it with Control F11.
05:29 As we can see, the decimal value has been stored and the value has been printed.
05:37 Now, let us change the value of the variable distance.
05:46 Add a lot of numbers after the decimal point as shown.
05:53 Save it and Run it.
06:01 we see that the output is little different from what has been stored.
06:06 This happens because there is a limit to the precision of a floating point number.
06:11 It is rounded off to the closest possible number if it cannot be stored accurately.
06:18 Now let us see the naming rules for variables.
06:23 Add a number 2 before the name.
06:30 we see that there is a syntax error.
06:34 This is because a variable name must only start with an alphabet or an underscore.
06:40 But generally 'underscore' is not used to start a variable name.
06:45 Now, let us add the number at the end of the variable name.
06:55 We see that there is no error.
06:59 A variable name can have digits but not at the beginning.
07:04 Now add an 'underscore' in the middle of the name,
07:15 we see that there is no error
07:17 which means an 'underscore' is permitted in a variable name.
07:22 But any other punctuation in a variable name might give a syntax error or other errors.
07:28 This is how you store numerical data in Java.
07:35 This brings us to the end of the tutorial.
07:38 In this tutorial, we have learnt about the various numerical data types
07:44 and how to store numerical data.
07:46 And we have also learnt the rules for naming a variable.
07:51 As an assignment for this tutorial,
07:53 read about other numerical data types and
07:56 see how they are different from int and float.
08:00 Java tutorials are available at the following link.
08:05 To know more about the Spoken Tutorial project, watch the video available at the following link. [1]
08:11 It summarizes the Spoken Tutorial project.
08:14 If you do not have good bandwidth, you can download and watch it.
08:20 The Spoken Tutorial Project team: conducts workshops using spoken tutorials.
08:24 Gives certificates to those who pass an online test. For more details, please write to contact AT spoken HYPHEN tutorial DOT org.
08:35 Spoken Tutorial Project is a part of the Talk to a Teacher project.
08:39 It supported by the National Mission on Education through ICT, MHRD, Government of India.
08:45 More information on this mission is available at the following link.
08:51 This tutorial has been contributed by TalentSprint. Thanks for joining.

Contributors and Content Editors

Gaurav, PoojaMoolya, Pratik kamble, Sandhya.np14, Sneha