1 00:00:11,700 --> 00:00:18,720 Hi again, everybody, I'm glad that you came to this lecture and today we will talk regarding methods 2 00:00:18,720 --> 00:00:26,880 practice, I will go over the two parts, the two assignments, and afterwards, I want you to try to 3 00:00:26,880 --> 00:00:29,550 get the answers by yourselves. 4 00:00:29,820 --> 00:00:35,290 And don't worry, you will always have the following video, which you can find the answers. 5 00:00:35,820 --> 00:00:42,540 OK, so these two parts will contain basically most of the topics that we have covered, the methods 6 00:00:43,050 --> 00:00:49,410 you would have to use, tools that we've studied, the methods and also in past topics as well, such 7 00:00:49,410 --> 00:00:51,660 as if statements for loops and so on. 8 00:00:52,080 --> 00:00:53,010 And. 9 00:00:53,010 --> 00:00:53,610 All right. 10 00:00:53,610 --> 00:00:58,860 I just want you to know that it's going to be a bit more challenging. 11 00:00:59,070 --> 00:01:04,980 But I think that you can you can perfectly get it together and resolve it by yourselves. 12 00:01:05,010 --> 00:01:10,590 You have all the tools that you needed in the previous lectures, and I think it's not a problem. 13 00:01:11,610 --> 00:01:14,270 OK, so let's go over the two assignments. 14 00:01:14,280 --> 00:01:14,660 All right. 15 00:01:15,480 --> 00:01:22,260 So in part a first of all, first first of all, create a new method and you can call it sorting. 16 00:01:22,890 --> 00:01:28,650 It will receive arbitrary arguments, meaning each time it will receive a different amount of arguments 17 00:01:28,950 --> 00:01:34,320 and you should execute it three times with the following variables passed into the method. 18 00:01:34,400 --> 00:01:38,950 OK, so in the first execution, please pass Python in Java. 19 00:01:39,450 --> 00:01:46,080 Second one is Python Java and go go with the Google programming language and in the third execution 20 00:01:46,080 --> 00:01:48,960 pass, Python, JavaScript and C++. 21 00:01:49,860 --> 00:01:55,740 OK, so once these variables are passed from the execution into the method inside the method, please 22 00:01:55,740 --> 00:01:56,500 do the following. 23 00:01:56,520 --> 00:01:56,960 All right. 24 00:01:57,660 --> 00:01:59,300 Please use a loop. 25 00:01:59,310 --> 00:02:00,450 OK, and fine. 26 00:02:00,450 --> 00:02:06,720 If Java is one of the values, OK, I want you to create a loop and each cycle of the loop will check 27 00:02:07,230 --> 00:02:11,460 one of these values and it will test whether it's Java or not. 28 00:02:12,270 --> 00:02:18,090 I'm not going to give you any more hints than that because I want you to think by yourselves on which 29 00:02:18,540 --> 00:02:23,510 topics and which techniques you should use here and get the resolution by yourselves. 30 00:02:23,520 --> 00:02:25,380 So it will be a bit more challenging. 31 00:02:25,920 --> 00:02:34,200 As in previous lectures, we you have got some guidance on what tools to use, but this time I just 32 00:02:34,560 --> 00:02:38,680 think by yourselves and use the tools that you've acquired from previous lectures. 33 00:02:38,700 --> 00:02:40,850 OK, so all right. 34 00:02:40,860 --> 00:02:49,320 So as I just mentioned, just fine with a java is one of the values each time Skåne one of these values. 35 00:02:49,530 --> 00:02:54,090 And once you find Java, please do the following thing. 36 00:02:54,090 --> 00:03:04,860 Please print that variable, the variable Java letters, one above the other inside the output terminal, 37 00:03:04,860 --> 00:03:13,140 meaning use to be printed in a way that the letters will go one under the other as following inside 38 00:03:13,140 --> 00:03:14,580 the output terminal. 39 00:03:14,650 --> 00:03:22,200 OK, so this basically covers the Part eight assignments regarding methods. 40 00:03:22,410 --> 00:03:25,320 There's nothing that you can't handle here. 41 00:03:25,320 --> 00:03:27,350 You're using the tools from previous videos. 42 00:03:27,390 --> 00:03:31,110 OK, so let's from here go to Poppy. 43 00:03:31,350 --> 00:03:34,300 Let's cover these topics as well. 44 00:03:34,320 --> 00:03:36,090 These are assignments as well. 45 00:03:36,360 --> 00:03:39,300 So in part B, OK, I create the method. 46 00:03:39,300 --> 00:03:41,250 You can call it tax calculation. 47 00:03:41,520 --> 00:03:45,630 We've already done some task calculation assignments in previous topics. 48 00:03:45,960 --> 00:03:47,340 And let's do it one more time. 49 00:03:48,600 --> 00:03:50,270 We'll get two variables. 50 00:03:50,280 --> 00:03:53,940 The method would get two variables, which will be gross salary and tax. 51 00:03:54,570 --> 00:04:02,100 And notice that if not tax variable is passed into the method, it should use zero that to two by default. 52 00:04:02,340 --> 00:04:02,780 All right. 53 00:04:04,440 --> 00:04:12,870 And right here you have the three three execution's three like groups of variables which will be passed 54 00:04:12,870 --> 00:04:15,450 to the method in three separate execution's. 55 00:04:15,810 --> 00:04:20,370 So you have five thousand is the salary and zero that to which is the tax. 56 00:04:20,670 --> 00:04:23,400 You have C six thousand and zero twenty two. 57 00:04:23,610 --> 00:04:28,470 And notice the last one is only the salary then grant ten grand. 58 00:04:28,710 --> 00:04:30,570 But the salary is not mentioned here. 59 00:04:30,790 --> 00:04:36,960 OK, so you need to overcome this so there is no error occurs once you execute the last one. 60 00:04:37,260 --> 00:04:37,750 All right. 61 00:04:39,000 --> 00:04:45,780 So in this first method, after we pass these variables into it, please calculate the net salary. 62 00:04:45,810 --> 00:04:52,350 OK, this is a variable inside it just need to initiate a new variable inside the method and calculate 63 00:04:52,350 --> 00:05:00,660 the net salary salary by reducing the tax out of the gross salary, which the gross salary is the the 64 00:05:00,660 --> 00:05:02,760 variable that was passed into the method. 65 00:05:03,060 --> 00:05:06,360 So apply tax reduction. 66 00:05:06,570 --> 00:05:09,410 You need to create a certain calculation. 67 00:05:09,780 --> 00:05:11,070 So just think the. 68 00:05:11,370 --> 00:05:15,220 Salary and remove the taxes from it. 69 00:05:15,280 --> 00:05:24,560 OK, and then once you reduce the gross salary, just return it at the end of the method, just return 70 00:05:24,560 --> 00:05:25,640 the gross salary. 71 00:05:26,750 --> 00:05:36,290 Once the method gets to the final stages, just return it outside of the method and also afterwards 72 00:05:36,290 --> 00:05:41,690 create the second method and call it salary limit testor. 73 00:05:41,840 --> 00:05:44,270 It should get the net salary variable. 74 00:05:44,630 --> 00:05:45,230 All right. 75 00:05:45,500 --> 00:05:48,940 And check whether it's above five thousand eight hundred. 76 00:05:48,980 --> 00:05:49,400 OK. 77 00:05:52,660 --> 00:05:53,320 All right. 78 00:05:55,240 --> 00:06:02,500 OK, so it should check whether the net salary is above above five hundred, either salary is above 79 00:06:02,740 --> 00:06:10,720 five thousand eight hundred stated state stated in a print and mentioned the value of the test and salary 80 00:06:12,430 --> 00:06:14,740 basically in both cases. 81 00:06:16,450 --> 00:06:20,470 Whether the salary is above or below. 82 00:06:21,970 --> 00:06:22,790 Stated. 83 00:06:23,110 --> 00:06:29,650 All right, so I think this covers let me just make it a bit smaller because it gets to the second page. 84 00:06:30,910 --> 00:06:35,780 All right, so basically you have two different assignments here. 85 00:06:36,400 --> 00:06:45,790 First one would use arbitrary arguments and the second one would use other subtopics that we have covered, 86 00:06:45,790 --> 00:06:52,000 such as using a default variable and such as passing variables from one method to another. 87 00:06:52,480 --> 00:06:57,550 OK, I will see in the next lecture where you can see the answers for these assignments. 88 00:06:57,580 --> 00:06:58,150 Good luck.