1 00:00:00,660 --> 00:00:06,210 Hello and welcome to this annual lesson in which we are going to take another example. 2 00:00:06,210 --> 00:00:14,080 This is a salary calculation example and this program we want to calculate the salary of workers as 3 00:00:14,080 --> 00:00:14,410 follows. 4 00:00:15,580 --> 00:00:24,370 If the working hours was greater than 40 hours per week each hour will be two dollars and any additional 5 00:00:24,430 --> 00:00:27,500 hour will be calculated with three dollars. 6 00:00:27,520 --> 00:00:36,750 So if you worked for 35 hours per week it will be counted and multiplied by two dollars. 7 00:00:36,820 --> 00:00:39,350 So you will take seventy dollars in total. 8 00:00:39,640 --> 00:00:47,410 But if you work for more than 40 hours let's say 70 hours the first 40 hours will be multiplied by two 9 00:00:47,410 --> 00:00:50,610 dollars while the remaining hours will shift. 10 00:00:50,620 --> 00:00:58,840 In this case our fair city will be multiplied with three dollars because they are treated like overtime. 11 00:00:58,930 --> 00:01:08,140 In your work so to make it more clear you are going to do this in flowchart and I'm going to explain 12 00:01:08,410 --> 00:01:11,040 the sequence in a step by step manner. 13 00:01:11,170 --> 00:01:15,780 But let's first write the equation here and this PowerPoint. 14 00:01:15,970 --> 00:01:27,670 Now if he did work for 40 hours he will take two dollars an hour about 40 will be counted as a three 15 00:01:27,680 --> 00:01:34,010 dollar hour and this can be done using a simple formula. 16 00:01:34,050 --> 00:01:39,300 Now let's start by creating a new blank diagram. 17 00:01:39,510 --> 00:01:48,670 Go to the flow chart area and start adding elements depending on your needs. 18 00:01:49,200 --> 00:01:54,720 As you can see here we have these two items for the start. 19 00:01:54,900 --> 00:02:01,470 You can either use this rectangle or round rectangle or use these two. 20 00:02:01,500 --> 00:02:02,640 We will use this one 21 00:02:06,250 --> 00:02:14,050 and we will use another one for the end now. 22 00:02:14,130 --> 00:02:18,310 After losing this this double clicked on name ID start 23 00:02:21,490 --> 00:02:22,290 now. 24 00:02:22,370 --> 00:02:26,440 The logic to solve this problem can be as follows. 25 00:02:26,440 --> 00:02:29,200 First find the number of hours. 26 00:02:29,470 --> 00:02:33,120 So we will take an input which is the number of hours 27 00:02:35,860 --> 00:02:43,000 read. 28 00:02:43,300 --> 00:02:46,160 The first item that I can write inside it. 29 00:02:46,180 --> 00:02:53,540 Use this one nested read pause. 30 00:02:53,630 --> 00:02:56,030 Now that we did three hours. 31 00:02:56,240 --> 00:03:01,700 The second step is to check if the number of hours is greater than 40. 32 00:03:01,700 --> 00:03:12,620 Now that this item and ask hours above 40. 33 00:03:12,860 --> 00:03:21,590 Now if yes we are going to apply an equation if no we are going to apply a different equation. 34 00:03:21,630 --> 00:03:28,480 Now if the answer were was yes and here then Sara was No. 35 00:03:28,490 --> 00:03:29,280 Now if yes 36 00:03:32,730 --> 00:03:35,610 salary will equal 37 00:03:38,100 --> 00:03:40,860 40 multiplied by two. 38 00:03:41,970 --> 00:03:48,240 Now I'm going to explain why did we use this now plus 39 00:03:50,980 --> 00:03:53,410 ours minus 40. 40 00:03:54,760 --> 00:03:57,370 Let's add another parentheses 41 00:04:00,420 --> 00:04:03,250 and that's also multiplied by three. 42 00:04:03,320 --> 00:04:15,440 I'm going to increase this now if no then hours salary equals hours multiplied by two. 43 00:04:16,920 --> 00:04:24,370 Now if the number of hours is above 40 This means that we have 40 hours multiplied by two. 44 00:04:24,370 --> 00:04:26,160 Now how to calculate the remaining hours. 45 00:04:26,170 --> 00:04:31,450 Let's say that we have 70 hour 70 minus 40 will be 30 hours. 46 00:04:31,450 --> 00:04:35,710 So the 50 hours would be multiplied by three and the total number would be the salary. 47 00:04:36,430 --> 00:04:37,490 But if no. 48 00:04:37,570 --> 00:04:47,290 This means that we have hours less than 40 and we are going to multiply these by two and this is it. 49 00:04:47,310 --> 00:04:50,330 This is how you can calculate the salary. 50 00:04:50,430 --> 00:04:53,980 In both cases we are going to do. 51 00:04:54,200 --> 00:05:00,280 We are going to print the salary and then we are going to stop. 52 00:05:00,280 --> 00:05:12,150 So in order to print let's use this shape print salary then and 53 00:05:20,150 --> 00:05:21,610 for both of these 54 00:05:24,850 --> 00:05:29,070 K but small this year. 55 00:05:29,480 --> 00:05:32,470 Let's hold this here. 56 00:05:32,590 --> 00:05:33,630 Let's write a text. 57 00:05:33,640 --> 00:05:34,210 If yes 58 00:05:38,070 --> 00:05:43,050 if no. 59 00:05:43,750 --> 00:05:47,260 Now let's do this again. 60 00:05:47,260 --> 00:05:48,540 Who will solve the problem. 61 00:05:48,550 --> 00:05:50,940 We will leave the number of hours after that. 62 00:05:50,950 --> 00:05:54,190 We are going to check of the hour's about 40. 63 00:05:54,250 --> 00:05:56,830 We are going to calculate using this equation. 64 00:05:56,830 --> 00:06:01,210 If they are below 40 you are going to multiply by two to calculate the salary. 65 00:06:01,210 --> 00:06:06,560 Then we are going to print the salary and stop the program. 66 00:06:06,940 --> 00:06:07,570 That's it. 67 00:06:07,570 --> 00:06:13,000 This is how you can calculate the salary for employees using flow charting. 68 00:06:13,000 --> 00:06:14,190 That is a step here. 69 00:06:14,230 --> 00:06:18,790 You can add it depending on whether you want to add it or not. 70 00:06:18,790 --> 00:06:26,150 We cut all this line and we can add a rectangle rectangular shape to define. 71 00:06:26,160 --> 00:06:26,620 I was 72 00:06:30,310 --> 00:06:32,160 on salary. 73 00:06:32,350 --> 00:06:35,620 This is variables 74 00:06:38,970 --> 00:06:45,850 out as equals zero salary equals zero. 75 00:06:45,890 --> 00:06:49,010 This can be used to add different variables to your program. 76 00:06:50,540 --> 00:06:57,620 You can add it or not depending on whether it's something you do usually or not. 77 00:06:57,620 --> 00:07:02,020 But anyway if you write your code you are going to need these variables. 78 00:07:02,030 --> 00:07:08,570 So I prefer adding it before starting my flowchart to make sure that I have all the variables I need 79 00:07:09,050 --> 00:07:11,240 defined before start coding. 80 00:07:11,240 --> 00:07:14,790 Now let's check this one again. 81 00:07:14,810 --> 00:07:23,930 If we have 70 hours 40 points applied by two will be 80 plus 70 minus 40 will be 30 multiplied by three 82 00:07:24,610 --> 00:07:35,610 three two by three will be 90 90 plus 80 will be a total of 400 and 70 dollars. 83 00:07:35,780 --> 00:07:43,860 If we are calculating this doughnut and this is how you can calculate a salary for sure you can color 84 00:07:44,130 --> 00:07:51,300 these depending again on your needs but that's it for this lesson if you have any questions please ask 85 00:07:51,300 --> 00:08:00,530 him that you aren't able I hope that now you are starting to understand flow charting the basic delivery 86 00:08:00,570 --> 00:08:06,450 for thinking on how to create your own flow chart if you have any question again ask him back you on 87 00:08:06,450 --> 00:08:09,210 the board thanks for sharing this is coding Academy.