1 00:00:01,840 --> 00:00:08,880 Well, this is the last activity of this course, and it's about programming. 2 00:00:10,519 --> 00:00:16,940 You have this activity, I think, explained very well in your book in Lesson 1. 3 00:00:17,600 --> 00:00:19,699 It's a very easy exercise. 4 00:00:20,719 --> 00:00:26,519 It's about if you want to scratch, that lets us to control our economy in a month. 5 00:00:26,519 --> 00:00:41,520 So as you always know, if you want to do or create a program, you must do it in three different steps. 6 00:00:41,520 --> 00:00:52,520 In the first step, what you should do is create an algorithm using computational thinking. 7 00:00:52,520 --> 00:01:04,519 So, first try to understand this problem of this project and discompose it in a simple one 8 00:01:04,519 --> 00:01:12,519 and then create an algorithm. You must express your algorithm using a flowchart. 9 00:01:12,519 --> 00:01:20,519 So for this example, a flowchart can be in this way. 10 00:01:20,519 --> 00:01:42,319 It's very complicated this flowchart because it has loops, it has conditionals, so we are 11 00:01:42,319 --> 00:01:45,420 going to explain step by step. 12 00:01:45,420 --> 00:01:46,420 What you have? 13 00:01:46,420 --> 00:01:56,239 Well you have firstly at least four variables that are incomes, outlows, savings and day. 14 00:01:56,239 --> 00:02:00,260 All of them are numbers. 15 00:02:00,260 --> 00:02:04,200 So you must define the variables and the type. 16 00:02:04,200 --> 00:02:09,759 Then you must start this variable. 17 00:02:09,759 --> 00:02:14,699 Let them evaluate at the beginning of the program. 18 00:02:14,699 --> 00:02:19,900 In this case 0 for these 3 and 1 for the 8. 19 00:02:19,900 --> 00:02:28,039 Well in your book I think one of these, I think incomes, is 150, if you want you can 20 00:02:28,039 --> 00:02:37,539 repeat with this value also. Then what happens? Well indeed you must input the 21 00:02:37,539 --> 00:02:45,400 value of income and also the value of payings or outlays and then you can 22 00:02:45,400 --> 00:02:52,780 calculate the save but obviously this is for the day one, the first 23 00:02:52,780 --> 00:02:59,379 day. So what happens if you calculate the saving you must know if the 24 00:02:59,379 --> 00:03:07,120 saving is more than 50 or less than 50 it is more than 50 it's okay it is less 25 00:03:07,120 --> 00:03:16,840 than 50 you must save more but it's just only for the first day you must continue 26 00:03:16,840 --> 00:03:25,539 with the program you must continue to the second day so here you have the loop 27 00:03:25,539 --> 00:03:35,419 the loop is until the day is more than 30 because months more or less have 30 or 28 00:03:35,419 --> 00:03:42,500 31 days but you usually do the calculation using just only 30. So you 29 00:03:42,500 --> 00:03:51,759 are going to repeat all these calculations and this question during 30 30 00:03:51,759 --> 00:04:02,319 times. That's the reason why we have this condition at the beginning. Well if you are in the day 31 31 00:04:05,039 --> 00:04:11,759 then you must tell if you have saved or not and finally is the end of the program. 32 00:04:11,759 --> 00:04:22,939 So, it's an easy one, but you must do the flowchart that can be in this way. 33 00:04:22,939 --> 00:04:29,579 You can do or imagine another algorithm that can solve the problem. 34 00:04:29,579 --> 00:04:36,759 In this case, algorithm is not just a mathematic thing, it's more flexible. 35 00:04:36,759 --> 00:04:40,139 So maybe you can express with another one. 36 00:04:40,139 --> 00:04:44,920 I think this is the best, but it's for me. 37 00:04:44,920 --> 00:04:47,379 Programming is something very personal. 38 00:04:47,379 --> 00:04:53,899 Well, if you have the algorithm then you must compile it. 39 00:04:53,899 --> 00:04:54,899 How? 40 00:04:54,899 --> 00:04:56,699 Using Scratch. 41 00:04:56,699 --> 00:05:08,339 Well Scratch, you can use Scratch online and I usually use Scratch online because for me 42 00:05:08,339 --> 00:05:16,579 is very comfortable because I don't have to save my scratches. You can have so many scratches you 43 00:05:16,579 --> 00:05:27,699 don't need to to save all of them. I hope that you remember how Scratch is used. Here you have 44 00:05:27,699 --> 00:05:37,100 create, create something, and if you want to create something you also can have 45 00:05:37,100 --> 00:05:48,519 different steps. The first step is to create the scenario because Scratch 46 00:05:48,519 --> 00:05:57,339 is a high-level language of programming but in this case is for 47 00:05:57,339 --> 00:06:02,779 blocks, so you need some blocks. The blocks are the sprite, but you need to 48 00:06:02,779 --> 00:06:11,680 create your scenery. And to create your scenery you need the background. You can 49 00:06:11,680 --> 00:06:18,939 choose a background from the from the library of Scratch. Here there are a lot 50 00:06:18,939 --> 00:06:30,060 of categories so you can use one of these, or if you want you also can upload a 51 00:06:30,060 --> 00:06:38,019 scenario from your computer if you want. Here there is a lot of scenario, export, 52 00:06:38,019 --> 00:06:45,920 upload, import, space, whatever, one of these. You must choose one of these 53 00:06:45,920 --> 00:06:58,649 Well, in their book they recommend one scenery, but you can choose another one if you don't 54 00:06:58,649 --> 00:07:01,790 like this scenery. 55 00:07:01,790 --> 00:07:19,839 I can remember the scenery, some patterns, space, outdoor, sport, music, whatever. 56 00:07:19,839 --> 00:07:23,660 One of these, whichever, it's not important the scenery. 57 00:07:23,660 --> 00:08:02,120 For example, we can choose a wall, and then we need at least one sprite. 58 00:08:02,120 --> 00:08:06,339 If you don't want to change, you can use this one. 59 00:08:06,339 --> 00:08:14,110 If you want to change the sprite, here you have a lot of sprites. 60 00:08:14,110 --> 00:08:18,930 It doesn't matter because the sprite is not important in this case. 61 00:08:18,930 --> 00:08:23,930 So here you have a lot of sprites, cats, etc. 62 00:08:23,930 --> 00:08:35,750 And if you want, each sprite has different characteristics. 63 00:08:35,750 --> 00:08:43,669 Its constants that you can change is the one, we have for example two constants in this 64 00:08:43,669 --> 00:08:52,970 case and to change it you have all of these so you can change for example you 65 00:08:52,970 --> 00:08:59,629 you can create your own cat changes the the parts the different parts of the 66 00:08:59,629 --> 00:09:21,610 cats or if you prefer for example you can change the year or you can change 67 00:09:21,610 --> 00:09:38,159 the eyes or whatever, if you want to change the scratch and give them your own version 68 00:09:38,159 --> 00:09:39,159 of scratch. 69 00:09:39,159 --> 00:09:45,480 Here are the custom, you have more than one. 70 00:09:45,480 --> 00:09:55,000 Also they have some sounds, you can change the sounds if you want. 71 00:09:55,000 --> 00:10:00,879 And finally, what is more important in this case is the code. 72 00:10:00,879 --> 00:10:08,620 For the code you have motion, if you want, you can change the appears, you can change 73 00:10:08,620 --> 00:10:24,679 the sounds, events, control, here you have a lot of blocks of codes in different 74 00:10:24,679 --> 00:11:02,799 categories. So, in our case, the code is this. So, we have a compiling 75 00:11:02,799 --> 00:11:14,399 the flowchart that we have designed. So, firstly, we have 76 00:11:14,399 --> 00:11:21,679 four variables. So variable is here. If you want to create a variable, just make 77 00:11:21,679 --> 00:11:30,720 a variable, give a name, and you have a new variable. In this case we have day, 78 00:11:30,720 --> 00:11:41,080 income, outlays, and saving. And except day, the rest of them are started to 79 00:11:41,080 --> 00:11:52,539 0. That's why. Then we must repeat for 30 times. So here you have 80 00:11:52,539 --> 00:12:00,460 the r variables, we have control and here in control you can repeat a 81 00:12:00,460 --> 00:12:10,580 number of times or forever or there are the two main loops that you have in 82 00:12:10,580 --> 00:12:19,899 in Scratch, or we can repeat a number of times, in this case 30, or forever. 83 00:12:19,899 --> 00:12:36,320 Then say to the ease, the incomes, the outlays, set saving as the difference between income 84 00:12:36,320 --> 00:12:45,419 and it is less than 50, you must save, or you are gay, no? 85 00:12:45,419 --> 00:12:55,840 You can know how much you can in your save, as a saving, and increase one day to second 86 00:12:55,840 --> 00:12:59,059 day until 30. 87 00:12:59,059 --> 00:13:02,299 So for example, today is day one. 88 00:13:02,299 --> 00:13:07,740 How much have you earned, for example, 1,000. 89 00:13:07,740 --> 00:13:23,169 paid 17 so you are well because there are well let's say supposing no incomes supposing 90 00:13:26,769 --> 00:13:40,379 well you have a more than 50 so third day no incomes supposing you must save because 91 00:13:40,379 --> 00:14:02,980 you have 40. Day 5. Day 5, suppose you were 500, nothing to pay, so well, because you are, well, 92 00:14:02,980 --> 00:17:40,900 0, 0, day 5, 6, 0, 0, until day 30. 93 00:17:40,900 --> 00:17:42,799 And that is. 94 00:17:42,799 --> 00:17:50,019 So at the end of the program they give you the incomes, the savings and also what you 95 00:17:50,019 --> 00:17:52,220 have paid. 96 00:17:52,220 --> 00:18:07,500 This is all, this is the program, so what you must do, you must save to your computer 97 00:18:07,500 --> 00:18:20,880 and this file is what you must submit, this file you must submit to the virtual classroom. 98 00:18:20,880 --> 00:18:30,279 This is all, I hope it can be helpful for you to understand it.