1 00:00:01,890 --> 00:00:03,010 Welcome back. 2 00:00:03,030 --> 00:00:11,550 I hope that you have successfully managed to solve these problem, right, so this challenge so if you 3 00:00:11,550 --> 00:00:18,150 did, then you can skip this lecture or you can straight look in the final version and see if you have 4 00:00:18,150 --> 00:00:18,930 done a good job. 5 00:00:18,960 --> 00:00:29,650 Now, there is a no right answer, meaning that everyone can fix or they do these challenge differently. 6 00:00:29,760 --> 00:00:32,820 So my approach today will be a little bit different. 7 00:00:33,810 --> 00:00:35,570 I'm going to open the best code here. 8 00:00:36,840 --> 00:00:40,710 So what I'm going to do, I just want to speed up a little bit things. 9 00:00:41,940 --> 00:00:46,410 So I'm going to open the folder and I'm going to open the starter file. 10 00:00:47,070 --> 00:00:47,420 Right. 11 00:00:48,000 --> 00:00:53,630 So if you start a file, I do have this index with its own styling. 12 00:00:53,670 --> 00:00:56,190 So there is a inline styling. 13 00:00:56,490 --> 00:00:58,470 I don't have external Cyesis file. 14 00:00:58,830 --> 00:00:59,130 Right. 15 00:00:59,130 --> 00:01:05,250 But I do have these Gere's and Appalachia's, which is empty in this image that I use. 16 00:01:06,150 --> 00:01:10,590 OK, now I'm going to go here, I'm going to open with live server. 17 00:01:10,590 --> 00:01:18,000 Right, click open with live server and I'm just going to copy to you were l I'm going to open with 18 00:01:18,000 --> 00:01:21,810 Google Chrome right now. 19 00:01:22,050 --> 00:01:22,700 There you go. 20 00:01:22,710 --> 00:01:28,250 Here, if you do inspect the console, log will be empty. 21 00:01:28,260 --> 00:01:28,920 There is nothing there. 22 00:01:28,920 --> 00:01:29,210 Right. 23 00:01:30,690 --> 00:01:42,300 OK, so what I'm going to do actually, I'm going to close this one and I'm just going to open this 24 00:01:42,420 --> 00:01:43,800 clinic parking challenge. 25 00:01:43,980 --> 00:01:45,270 I'm going to go to the final one. 26 00:01:45,540 --> 00:01:50,550 The is going to copy it and I'm going to put it here outside. 27 00:01:51,030 --> 00:01:52,740 So I'm going to do this because. 28 00:01:54,850 --> 00:01:55,870 Open fire. 29 00:01:57,070 --> 00:02:03,890 I'm going to use this on desktop ears, so this is the Finnish version, so I'm just going to copy it. 30 00:02:05,920 --> 00:02:11,740 And I'm going to put it here and I'm going to delete a couple of the things, but I'm just going to 31 00:02:11,740 --> 00:02:14,860 make a starting point, right? 32 00:02:15,340 --> 00:02:16,750 I'm just going to make a starting point. 33 00:02:16,780 --> 00:02:17,210 Good. 34 00:02:17,650 --> 00:02:19,330 Now, the data, we'll leave it there. 35 00:02:19,810 --> 00:02:20,750 This function. 36 00:02:20,770 --> 00:02:29,680 I really don't need I can create all of these functions and also this map method, this one. 37 00:02:29,680 --> 00:02:30,640 So you can do it with me. 38 00:02:31,900 --> 00:02:36,610 I want to have this. 39 00:02:36,620 --> 00:02:39,760 I want to have the parent class, the parking, the clinical class. 40 00:02:39,940 --> 00:02:42,570 I want to have the data, the clinical report. 41 00:02:43,060 --> 00:02:43,710 Very good. 42 00:02:44,560 --> 00:02:50,740 I want to have this one cut this cut that one make a little bit here. 43 00:02:50,740 --> 00:02:56,470 And that's pretty much, you know why I want this, because that will save us a ton of time. 44 00:02:56,830 --> 00:03:04,270 OK, so nothing will happen because we're not printing anything and we are calling here the reports. 45 00:03:04,300 --> 00:03:05,910 OK, now go from top. 46 00:03:06,730 --> 00:03:11,800 So my class as a parent or super class is a building class. 47 00:03:12,430 --> 00:03:12,940 Why? 48 00:03:13,630 --> 00:03:21,110 Because in the report are seeing here all of the clinics in parking have the building address in your. 49 00:03:21,550 --> 00:03:24,940 So me that this is a perfect solution to find a parent class. 50 00:03:25,210 --> 00:03:31,110 These class will actually be used here and extended by the parking and clinic. 51 00:03:31,390 --> 00:03:36,660 Now we only have three classes, two will be subclasses in one class. 52 00:03:36,880 --> 00:03:39,220 That's it for this project. 53 00:03:39,220 --> 00:03:40,090 For this challenge. 54 00:03:40,270 --> 00:03:41,280 That's enough. 55 00:03:41,500 --> 00:03:44,790 So let's create a constructor here. 56 00:03:44,870 --> 00:03:52,840 Now, the first thing I think first when the when a class is called is going to be called the constructor. 57 00:03:52,990 --> 00:03:57,760 So I'm going to put here address in here built. 58 00:03:57,970 --> 00:03:58,370 Right. 59 00:03:58,720 --> 00:03:59,030 Good. 60 00:03:59,410 --> 00:04:05,110 Now I'm going to see these addressed equal to the address we are passing through a contractor. 61 00:04:05,380 --> 00:04:08,230 These here, Bill, equal to the bill. 62 00:04:08,230 --> 00:04:12,490 We are passing through the constructor now for the parking. 63 00:04:12,670 --> 00:04:17,020 The parking now can extend this by calling the super constructor. 64 00:04:17,290 --> 00:04:20,310 So also the parking will have its own constructor. 65 00:04:21,880 --> 00:04:25,110 But first, we need to address in here. 66 00:04:25,360 --> 00:04:27,760 These are from the Supercoach program. 67 00:04:28,060 --> 00:04:34,830 And after those side, we could just call the super constructor we address in your bill. 68 00:04:35,140 --> 00:04:35,880 And that's it. 69 00:04:35,890 --> 00:04:37,870 This is how we have done the habitants. 70 00:04:38,320 --> 00:04:43,750 Now, this parking will have a couple of more things that we need to do. 71 00:04:43,930 --> 00:04:53,260 We can say size here, size will be the full size for both all old parking and hourly parking spots. 72 00:04:53,260 --> 00:04:55,720 And I'm going to see here fool spots. 73 00:04:59,210 --> 00:05:00,310 Or at least parts. 74 00:05:02,690 --> 00:05:12,480 Thrice hourly in food, the price, so this will be three dollars, nine dollars in here. 75 00:05:12,890 --> 00:05:15,620 This depends on just how many we're going to pass it here. 76 00:05:15,830 --> 00:05:17,420 Now you have this data. 77 00:05:17,510 --> 00:05:18,540 Twenty, sixteen. 78 00:05:18,560 --> 00:05:20,850 And the address come from the superclass. 79 00:05:21,110 --> 00:05:23,630 This will be a one hundred and fifty the size. 80 00:05:23,630 --> 00:05:24,870 We're not going to use this much. 81 00:05:25,430 --> 00:05:25,970 We're not done. 82 00:05:25,970 --> 00:05:28,550 But I'm just showing where this data is coming from. 83 00:05:28,820 --> 00:05:31,370 This 90 and 60 will be 90 full. 84 00:05:31,820 --> 00:05:35,720 All the parking spots and 60 will be hourly parking spots. 85 00:05:35,730 --> 00:05:38,660 So if you combine these two, it will give you one hundred and fifty. 86 00:05:38,660 --> 00:05:43,690 So I just you can you don't need to put the size, but I just want to be there. 87 00:05:43,730 --> 00:05:44,030 Good. 88 00:05:44,600 --> 00:05:46,190 Oh, what else? 89 00:05:46,670 --> 00:05:52,430 I can just get rid of this for 09 here and we can have pretty much something similar. 90 00:05:52,550 --> 00:05:56,570 Now, I'm just going to go back here. 91 00:05:56,600 --> 00:06:02,300 We need to finish these stop signs equal to the size we are passing through a constructor does that 92 00:06:02,300 --> 00:06:05,170 few spots equal to the full spots. 93 00:06:05,180 --> 00:06:06,220 Let's finish this one. 94 00:06:07,730 --> 00:06:12,650 This that hourly pass, it will be equal to hourlies, plus the stock price. 95 00:06:15,350 --> 00:06:27,860 Hourly price hourly and this that food, the price equal to food, they for good. 96 00:06:28,230 --> 00:06:31,500 Now, that is our parking class. 97 00:06:31,700 --> 00:06:35,030 What about our cleaning class where our class will be smaller? 98 00:06:35,630 --> 00:06:36,950 We will have, again, constructor. 99 00:06:36,950 --> 00:06:40,300 We address from the superclass in here called Bill. 100 00:06:40,700 --> 00:06:44,180 After that, we now say daily or we can say just patience. 101 00:06:45,650 --> 00:06:46,340 Patience. 102 00:06:47,880 --> 00:06:49,110 That's what a daily basis. 103 00:06:51,360 --> 00:06:58,110 As it is in the final version, so daily basis and what else here I'm going to say sighs now decides 104 00:06:58,110 --> 00:07:00,630 I'm not going to put anything in the size of the moment. 105 00:07:01,440 --> 00:07:09,630 We need to call the super constructor first year bill, then these that daily is equal to the daily 106 00:07:09,630 --> 00:07:12,960 basis and these that size equal to the size. 107 00:07:14,520 --> 00:07:15,270 OK. 108 00:07:16,890 --> 00:07:17,750 Now we are ready. 109 00:07:17,760 --> 00:07:22,020 These are both of this clinic is extending the building class. 110 00:07:23,250 --> 00:07:23,840 Right. 111 00:07:23,850 --> 00:07:26,860 And that is what it makes the inheritance easy. 112 00:07:27,600 --> 00:07:27,890 Good. 113 00:07:28,320 --> 00:07:34,470 Now what we can do here, instead of writing a couple of new instances of a clearly class in a couple 114 00:07:34,470 --> 00:07:40,380 of years to sort of a working class, I just realized that it will be easier if we put them as an error 115 00:07:40,950 --> 00:07:41,430 in here. 116 00:07:41,430 --> 00:07:44,280 I will create new four new clinics first. 117 00:07:44,280 --> 00:07:47,880 It will have the address and the year that will come from the parent class. 118 00:07:48,090 --> 00:07:54,090 Then one hundred and five will be the daily pages and the size will be three, then size will be three, 119 00:07:54,090 --> 00:07:55,710 three, one and two. 120 00:07:56,040 --> 00:07:58,500 So what is this one and two size. 121 00:07:58,770 --> 00:08:00,330 OK, in our. 122 00:08:02,710 --> 00:08:08,390 In our here in our report is simply excise could be small, normal and big. 123 00:08:08,410 --> 00:08:12,200 So this is the best way to put a map. 124 00:08:12,790 --> 00:08:17,370 So we need we need to use our new data structure that we learn. 125 00:08:17,590 --> 00:08:18,520 That was map. 126 00:08:18,520 --> 00:08:18,900 Right. 127 00:08:19,210 --> 00:08:27,000 And I'm going to put zero as a small one is normal in solving one is a small two as a normal thing. 128 00:08:27,010 --> 00:08:27,840 Three is a big. 129 00:08:28,570 --> 00:08:37,210 So that is why I put one, two, three, because the map alone allows allowed us to create a separate 130 00:08:37,390 --> 00:08:41,290 or custom data custom data type. 131 00:08:41,470 --> 00:08:42,340 I mean custom. 132 00:08:43,930 --> 00:08:46,190 We could put custom value there, for example. 133 00:08:46,190 --> 00:08:48,880 It can mean Dejour string, it can be a boolean. 134 00:08:48,910 --> 00:08:49,270 Right. 135 00:08:49,510 --> 00:08:50,490 We learn about that. 136 00:08:50,650 --> 00:08:51,820 Same goes for this. 137 00:08:52,030 --> 00:08:54,210 This is the size, this is the full spot. 138 00:08:54,410 --> 00:08:56,150 This is the hourly spot. 139 00:08:56,170 --> 00:08:58,420 This is a price of three dollars per hour. 140 00:08:58,570 --> 00:09:00,910 And this is the old parking space. 141 00:09:01,480 --> 00:09:07,550 And these two are coming from the superclass, our parent class or the building. 142 00:09:07,840 --> 00:09:12,340 Now, here, we're going to do the clinical report as he comes along. 143 00:09:14,080 --> 00:09:18,460 And I'm going to put it like this Kleenex report. 144 00:09:20,740 --> 00:09:22,420 OK, now copy this. 145 00:09:22,840 --> 00:09:26,940 Make sure that you have one, one or two more. 146 00:09:27,190 --> 00:09:29,620 So I'm just going to copy this and pasted on the other side. 147 00:09:30,340 --> 00:09:30,730 Right. 148 00:09:31,120 --> 00:09:37,240 And make sure that you copy this one based in on this one and see parking's. 149 00:09:40,350 --> 00:09:40,800 Report. 150 00:09:40,890 --> 00:09:50,190 So here we call these two external functions, but what I want I want each side to pack up the data 151 00:09:50,190 --> 00:09:51,220 that we just created. 152 00:09:51,240 --> 00:09:53,280 Right, good. 153 00:09:54,300 --> 00:10:00,670 So if I refresh now, if I go back here, I will have clinics report here in the parking parking's report. 154 00:10:01,020 --> 00:10:01,320 Good. 155 00:10:01,740 --> 00:10:03,660 Now, what we will do next. 156 00:10:03,940 --> 00:10:06,610 So I'm going to close this one because we don't need it anymore. 157 00:10:09,030 --> 00:10:10,620 Now, first things first. 158 00:10:10,620 --> 00:10:12,960 We need to decide what we need to print. 159 00:10:13,140 --> 00:10:15,870 And we are just going to print this. 160 00:10:17,030 --> 00:10:22,740 This we just going to deal with this number three here, three one, two in. 161 00:10:22,920 --> 00:10:29,460 We're going to create a function in that function will be called from our clinical report. 162 00:10:29,460 --> 00:10:35,710 And that is actually if you go back here, that is actually the last things. 163 00:10:36,570 --> 00:10:40,650 So what I want to do actually at the moment, first I want to comes 164 00:10:43,290 --> 00:10:54,540 the here comes a lot of the clinics and but I need to pass in the Senate so you can pass the same variable 165 00:10:54,540 --> 00:10:54,870 here. 166 00:10:54,870 --> 00:10:56,280 But I'm going to say clinics here. 167 00:10:57,180 --> 00:10:57,660 So. 168 00:11:01,210 --> 00:11:05,110 So you need to pass the area clinics in here, I'm going to say parking's. 169 00:11:07,870 --> 00:11:08,170 Good. 170 00:11:08,380 --> 00:11:14,680 So if comes I love the clinics, I will have the entire area here is of all the clinics. 171 00:11:14,710 --> 00:11:23,650 So what I want to do is actually to create a function for seeing what is the size of this clinic. 172 00:11:23,890 --> 00:11:25,870 So what I'm going to do, I'm going to say. 173 00:11:28,370 --> 00:11:28,850 Here. 174 00:11:31,020 --> 00:11:34,330 I'm going to say clinics, not for each. 175 00:11:34,950 --> 00:11:40,710 I'm going to look through each and every clinic in the current element, so I'm going to use the error 176 00:11:40,710 --> 00:11:41,490 function here. 177 00:11:41,610 --> 00:11:46,750 And I'm going to say current that we haven't created this function yet. 178 00:11:47,830 --> 00:11:52,440 Building, building, spec classification. 179 00:11:54,660 --> 00:11:59,920 OK, so I'm going to call it from the current element. 180 00:11:59,940 --> 00:12:04,620 I'm going to call this function what I'm calling from the current element. 181 00:12:04,920 --> 00:12:07,570 Well, I just want to grab from each and every element. 182 00:12:07,770 --> 00:12:13,440 This the last part, the last value, and that will be the size of the building. 183 00:12:13,470 --> 00:12:19,940 OK, so I'm going to copy this and I'm going back to clinics in here. 184 00:12:19,950 --> 00:12:21,990 We need to create dysfunction. 185 00:12:22,140 --> 00:12:25,530 So how are we going to call this function the same as we did here? 186 00:12:25,590 --> 00:12:26,010 Right. 187 00:12:26,040 --> 00:12:35,520 So I'm going to say like that in here, inside, I'm going to say const wieneke size and that will be 188 00:12:35,520 --> 00:12:37,620 equal to new map. 189 00:12:38,160 --> 00:12:39,580 So I'm going to create an empty map. 190 00:12:39,600 --> 00:12:42,480 So this was the perfect solution to create example. 191 00:12:42,480 --> 00:12:44,190 To use hash maps. 192 00:12:44,310 --> 00:12:44,580 Right. 193 00:12:44,850 --> 00:12:45,720 Or our map. 194 00:12:47,760 --> 00:12:48,120 Nice. 195 00:12:48,660 --> 00:12:49,820 So I'm creating a new map. 196 00:12:49,830 --> 00:12:51,250 So how we set the map. 197 00:12:51,810 --> 00:12:53,790 So now we can see clinic size. 198 00:12:56,500 --> 00:13:05,290 That set and I'm going to set one and I'm going to be small here. 199 00:13:06,190 --> 00:13:10,910 So now you know why this is one, two and three, right? 200 00:13:11,140 --> 00:13:12,910 So the first was the key. 201 00:13:12,910 --> 00:13:14,100 The second was the value. 202 00:13:14,260 --> 00:13:15,430 So I'm setting the value. 203 00:13:15,430 --> 00:13:17,170 Two in three here. 204 00:13:17,410 --> 00:13:23,410 You see here normal because that was our report. 205 00:13:26,350 --> 00:13:28,900 Where was it so small, normal in big? 206 00:13:32,460 --> 00:13:39,250 Now, you can see here small, small, small, normal and big in here, you can put small, small, 207 00:13:39,960 --> 00:13:45,550 big, big, small, normal, for example, if you want to use strings so you can use whatever you want. 208 00:13:45,840 --> 00:13:56,460 Now, here I just say Conjola, I'm going to use the template literals and I'm going to see these address. 209 00:13:57,240 --> 00:13:57,620 Right, 210 00:14:00,690 --> 00:14:04,860 plus built in 211 00:14:08,610 --> 00:14:13,530 this year build and Colma is 212 00:14:16,050 --> 00:14:19,000 Alesi clinic site. 213 00:14:19,260 --> 00:14:22,650 So how we get the values using the get keyword in here. 214 00:14:22,650 --> 00:14:28,540 I'm going to pass this size now and I'm going to say cleaning that. 215 00:14:30,560 --> 00:14:32,640 Let's see what's happening now. 216 00:14:32,650 --> 00:14:37,940 This one's history is a big clinic, is a big clinic, is a small clinic, is a normal clinic. 217 00:14:38,070 --> 00:14:38,510 Good. 218 00:14:39,180 --> 00:14:46,350 Now we access these year and the address from the parents of reclass and actually this is working. 219 00:14:46,560 --> 00:14:54,030 But what if we don't have any any data here. 220 00:14:55,320 --> 00:14:58,310 So undefined clinic, undefined, undefined. 221 00:14:58,530 --> 00:15:04,680 So that's what we you we learned that we can use a default parameters and I'm going to say equal to 222 00:15:04,680 --> 00:15:05,070 two. 223 00:15:05,310 --> 00:15:09,090 And these always will be normal if we don't pass anything here. 224 00:15:09,870 --> 00:15:12,090 Normal, normal, normal clinic. 225 00:15:12,270 --> 00:15:15,100 Now you know how to use the default parameters. 226 00:15:15,570 --> 00:15:20,370 Now we again repeat the Hashmat and I'm just going to return this back here. 227 00:15:21,810 --> 00:15:23,010 I think it was three. 228 00:15:24,390 --> 00:15:30,300 Three I think was one maybe or I'm not sure. 229 00:15:30,990 --> 00:15:32,250 One or two probably. 230 00:15:33,530 --> 00:15:35,280 So save it now. 231 00:15:35,850 --> 00:15:38,160 It will go big, big, small, normal. 232 00:15:38,310 --> 00:15:41,640 Good, because it will override this. 233 00:15:41,640 --> 00:15:44,160 Number two, if we pass some value here. 234 00:15:44,460 --> 00:15:44,820 Good. 235 00:15:45,420 --> 00:15:51,660 Now you know how we can use the Hashmat, how we can set the clinic size and we can get it up. 236 00:15:51,990 --> 00:15:52,380 Good. 237 00:15:52,380 --> 00:15:56,300 Now you don't need to control this here. 238 00:15:57,900 --> 00:16:00,150 So that was the final step. 239 00:16:00,300 --> 00:16:06,210 So we went we went on the last one and that was pretty much easy. 240 00:16:06,360 --> 00:16:11,490 So our job in the next election will be to create from number one on to number eight. 241 00:16:11,790 --> 00:16:15,660 And for that reason, we need to create a function. 242 00:16:15,700 --> 00:16:22,380 Karkoc patients in that function will loop through each and every patient and will grab the number, 243 00:16:22,380 --> 00:16:26,820 because here we do have in the day we sending the patients. 244 00:16:27,600 --> 00:16:34,140 Here is one of five one seventy two three three three three is sixty six or the number of patients in 245 00:16:34,140 --> 00:16:35,280 each clinic daily. 246 00:16:35,280 --> 00:16:35,640 Right. 247 00:16:36,120 --> 00:16:37,620 So that is pretty much it. 248 00:16:37,620 --> 00:16:44,010 I hope I'm going to see you in the next one and read the documentation again, because when I do this 249 00:16:44,010 --> 00:16:46,180 it will be easier to understand. 250 00:16:46,530 --> 00:16:47,980 So that's pretty much it. 251 00:16:48,000 --> 00:16:49,650 And I will see you in the next one.