All language subtitles for 9. Finding a Driving Time - Solution

af Afrikaans
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,900 --> 00:00:01,740 Welcome back. 2 00:00:01,770 --> 00:00:09,180 So in this video, we will solve the problem of getting from point A to point B.. 3 00:00:09,350 --> 00:00:16,590 OK, so what we will do is simply to initialize two variables, which are the distance between, let's 4 00:00:16,590 --> 00:00:19,110 say, 18 kilometers units. 5 00:00:19,620 --> 00:00:25,920 And also we'll have that the speed that the vehicle is going to be driving. 6 00:00:26,160 --> 00:00:27,340 So we have the speed. 7 00:00:27,810 --> 00:00:33,240 Also, let's say in terms of kilometers per hour, for example. 8 00:00:33,300 --> 00:00:40,140 OK, so if it's not kilometers per hour or maybe some other unit, of course, it may be also calculated 9 00:00:40,860 --> 00:00:42,370 using other units. 10 00:00:42,390 --> 00:00:47,450 I'm going to use the distance as the kilometers and the speed is kilometers per hour. 11 00:00:48,210 --> 00:00:56,130 And once we know the distance and the speed, we will we should calculate the time that it should take 12 00:00:56,130 --> 00:01:05,600 vehicle, our vehicle, our car to reach from city to city B so time in this case will be equal to what? 13 00:01:06,210 --> 00:01:15,240 So we know that first of all, let's say we know that distance distance equals to speed multiplied by 14 00:01:15,240 --> 00:01:15,660 time. 15 00:01:15,690 --> 00:01:15,990 Right. 16 00:01:16,020 --> 00:01:21,210 So if you drive at some speed and you multiply it by time, you will get the distance that you will 17 00:01:21,210 --> 00:01:21,670 pass. 18 00:01:22,260 --> 00:01:27,270 So just by modifying this equation a little bit, we will get that. 19 00:01:27,360 --> 00:01:30,990 Time equals distance divided by speed. 20 00:01:31,290 --> 00:01:35,760 So distance the distance divided by speed. 21 00:01:36,180 --> 00:01:43,980 So that's the formula that we are going to use to calculate the result of the calculate the actual time 22 00:01:43,980 --> 00:01:47,340 that it will take to reach from city to city B.. 23 00:01:48,120 --> 00:01:51,970 And we are requested to initialize these very these variables. 24 00:01:51,990 --> 00:01:58,710 So for that, we will simply use distance and the distance is going to be something like, I don't know, 25 00:01:58,950 --> 00:02:02,610 300 kilometers, OK, kilometers. 26 00:02:03,310 --> 00:02:11,350 And also we will have the speed is something like, I don't know, 75 kilometers per hour. 27 00:02:11,370 --> 00:02:13,770 OK, so why meters per hour? 28 00:02:13,800 --> 00:02:15,270 That's the speed of the vehicle. 29 00:02:16,290 --> 00:02:26,140 And if we will use here time, OK, we can say that time equals to distance distance divided by speed. 30 00:02:26,170 --> 00:02:26,510 Right. 31 00:02:26,520 --> 00:02:31,150 We have here our formula time equals the distance divided by speed. 32 00:02:31,170 --> 00:02:38,580 We already explain it and the time itself is going to be in what units? 33 00:02:38,760 --> 00:02:46,040 It's going to be in our units hours, how many hours it took to reach from point A to point B.. 34 00:02:46,260 --> 00:02:59,610 So if we will ride to the solution like this or half the time for driving from A to B, we'll take, 35 00:02:59,610 --> 00:03:02,180 I don't know, percentage these powers. 36 00:03:02,340 --> 00:03:02,750 Right. 37 00:03:03,240 --> 00:03:07,230 And here, of course, let's just minimize it a little bit. 38 00:03:07,530 --> 00:03:13,110 Instead of the percentage placeholder, we will use time, right? 39 00:03:14,280 --> 00:03:20,670 So awesome, so the time for driving from A to B will take a percentage these hours. 40 00:03:21,330 --> 00:03:27,690 So if we divide distance by speed, we will get three hundred divided by seventy five, which is, if 41 00:03:27,690 --> 00:03:30,960 I'm not mistaken, just four hours. 42 00:03:31,050 --> 00:03:36,940 OK, so let's build and run this program to make sure that it works exactly as we expected. 43 00:03:37,170 --> 00:03:37,560 Yeah. 44 00:03:37,560 --> 00:03:42,180 So the time for driving from A to B will take four hours if you drive it. 45 00:03:42,190 --> 00:03:49,950 Seventy five kilometers per hour and you do it and the distance is three hundred kilometers. 46 00:03:50,850 --> 00:04:00,450 But it's very important to notice here and basically for you to understand is that this answer is not 47 00:04:00,450 --> 00:04:08,400 entirely correct, since it's not necessary that the time will be exactly four hours on the clock. 48 00:04:09,060 --> 00:04:12,350 The time may also consist of minutes, right. 49 00:04:12,360 --> 00:04:17,640 The time may be also like four hours and 10 minutes, four hours and 20 minutes. 50 00:04:18,090 --> 00:04:21,000 He doesn't necessarily have to be some integer. 51 00:04:21,030 --> 00:04:24,460 Right, for example, represented just in terms of hours. 52 00:04:24,960 --> 00:04:33,330 So how should we also calculate the minutes that it took us to drive from point A to point B so that 53 00:04:33,480 --> 00:04:40,770 finally the result will be represented like he took us four hours and 10 minutes to reach from point 54 00:04:40,770 --> 00:04:41,840 A to point B? 55 00:04:41,990 --> 00:04:48,080 OK, so basically this calculation time equals distance divided by speed. 56 00:04:48,480 --> 00:04:56,130 It will give us just the the integer, just the the total hours, the full hours it took us to drive. 57 00:04:56,580 --> 00:05:02,280 But if, for example, we had, I don't know, speed instead of seventy five, even the speed was 80 58 00:05:03,120 --> 00:05:06,090 then what should be pointed to the screen now. 59 00:05:06,090 --> 00:05:14,220 Because we know that if we divide 300 by eight then it simply will be three hundred divided by eight. 60 00:05:14,910 --> 00:05:18,180 It will simply give us what will be three. 61 00:05:18,180 --> 00:05:18,660 Right. 62 00:05:18,660 --> 00:05:19,950 Three hours. 63 00:05:20,490 --> 00:05:23,880 Three total hours because time is of an integer type. 64 00:05:23,890 --> 00:05:28,460 So three hundred divided by eight will give us three hours. 65 00:05:28,680 --> 00:05:32,520 But what about the remaining three hours. 66 00:05:32,520 --> 00:05:36,880 Took us to complete two hundred and forty kilometers. 67 00:05:37,410 --> 00:05:41,280 What about the other 60 kilometers that were left. 68 00:05:41,520 --> 00:05:42,870 How should we calculate them. 69 00:05:43,360 --> 00:05:48,410 Basically we know that 60 kilometers it will take us less than an hour to complete. 70 00:05:48,450 --> 00:05:50,190 It will take us about 40 minutes. 71 00:05:50,190 --> 00:05:53,230 Something like this, 30 minutes, 40 minutes to complete. 72 00:05:53,250 --> 00:05:57,950 So how we should also calculate the timing hours. 73 00:05:58,470 --> 00:06:04,710 So first of all, what I suggest to do is to modify this variable and to call it instead of time, probably 74 00:06:04,800 --> 00:06:05,400 hours. 75 00:06:05,490 --> 00:06:12,180 OK, that's the total amount of hours they took to complete a given portion of the distance. 76 00:06:12,690 --> 00:06:18,690 And also what we should do is to create additional variable speeds flow. 77 00:06:19,050 --> 00:06:22,380 So float speed in minutes. 78 00:06:23,720 --> 00:06:30,690 Basically, that's the remaining speed and it will be equal to let's say, no, it's not. 79 00:06:31,080 --> 00:06:37,620 Let's use speed in minutes, not for the remaining part of the minutes, but rather just to calculate 80 00:06:37,620 --> 00:06:38,520 the speed. 81 00:06:38,670 --> 00:06:40,080 OK, just the calculator. 82 00:06:40,090 --> 00:06:43,860 That was my mistake, just to calculate the speed in minutes. 83 00:06:43,860 --> 00:06:50,190 So we have here the information that the speed per hours equals to this one, right. 84 00:06:50,310 --> 00:06:51,890 Kilometers per hour. 85 00:06:52,440 --> 00:06:59,140 And what I want us to do now is simply to represented this how many kilometers we will pass in a minute. 86 00:06:59,610 --> 00:07:05,660 So for that, we simply take the speed, the previous speed and divided by 60. 87 00:07:06,390 --> 00:07:08,220 And this will give us the speed. 88 00:07:08,480 --> 00:07:12,450 OK, the total amount of kilometers per minute. 89 00:07:12,510 --> 00:07:21,030 OK, so if we do gusts are 80 kilometers per hour and now it will take us eighty divided by 60 kilometers 90 00:07:21,030 --> 00:07:21,930 per minute. 91 00:07:22,260 --> 00:07:24,300 And I only remember what it is. 92 00:07:24,300 --> 00:07:28,690 It's kind of one point three three three kilometers per minute. 93 00:07:29,280 --> 00:07:35,880 So once you have this information, what we will have to do is to create additional variables. 94 00:07:35,880 --> 00:07:45,030 For example, minutes, remaining minutes, let's call it even this way, the remaining minutes, right. 95 00:07:45,660 --> 00:07:49,290 So remaining remaining remaining minutes. 96 00:07:49,680 --> 00:07:56,760 And once we have the remaining minutes, we know that, first of all, what we will take is the remainder 97 00:07:56,760 --> 00:08:06,560 of the distance divided right for speed, OK, which is simply the 60 kilometers we have previously. 98 00:08:07,050 --> 00:08:13,560 And how how many minutes, OK, how many minutes did it take us to complete? 99 00:08:14,030 --> 00:08:20,340 OK, the distance, that's the distance that left OK there. 100 00:08:20,480 --> 00:08:27,590 For example, if we had three hundred kilometers, so three hours, four hours, we passed two hundred 101 00:08:27,590 --> 00:08:33,590 and forty kilometers and all that's left is three hundred minus two hundred and forty, which is 60 102 00:08:33,590 --> 00:08:39,830 kilometers divided by the speed in minutes, the speed in minutes. 103 00:08:40,850 --> 00:08:47,690 And in this case, what we will get is the result of the remaining minute units. 104 00:08:49,100 --> 00:08:52,510 And finally you give everything was OK. 105 00:08:52,520 --> 00:09:01,160 So the time for driving the time, let's say, from A to B will take percentage hours and percentage 106 00:09:01,160 --> 00:09:07,610 DKK minutes and here will specify the hours and the remaining minutes. 107 00:09:07,700 --> 00:09:12,830 OK, guys, so I hope it's clear to you as to why we're using that. 108 00:09:13,280 --> 00:09:21,950 So let's let's just build and run it and see for ourselves that everything is working as expected. 109 00:09:22,310 --> 00:09:27,410 So the time from A to B will take three hours and 44 minutes. 110 00:09:27,680 --> 00:09:35,950 I think that something was with the with the casting here, but yeah, it should be. 111 00:09:36,020 --> 00:09:36,550 Yeah. 112 00:09:37,400 --> 00:09:42,170 So, yeah, it's very strange why we got here. 113 00:09:42,170 --> 00:09:45,500 Forty four minutes instead of forty five minutes. 114 00:09:45,890 --> 00:09:54,590 Something probably got missing with the grounding, so let's maybe try to find it out and. 115 00:09:55,970 --> 00:10:04,760 Oh yeah, it's probably here, it's rounded up to forty four and the reason is very simple because here 116 00:10:04,790 --> 00:10:12,500 we have distance and speed divided by speed which gives us an integer in this case divided by a floating 117 00:10:12,500 --> 00:10:14,680 point, and the result is a floating coin type. 118 00:10:14,960 --> 00:10:20,840 So basically we can use it here not to complicate everything for this exercise, like she is here to 119 00:10:20,840 --> 00:10:27,760 float remaining minutes and here he is, percentage F, OK, and in this percentage, two point two. 120 00:10:28,070 --> 00:10:32,240 So let's build in running just to make sure that everything works as expected. 121 00:10:32,240 --> 00:10:39,530 So the time for me to be will take three hours and forty five minutes, which is exactly the result 122 00:10:39,530 --> 00:10:41,000 we expected to receive. 123 00:10:41,720 --> 00:10:50,390 So it was not easy I guess, but ah I think you kind of understood what I meant and that the previous 124 00:10:50,600 --> 00:11:00,230 some, some of the basic explanations that some of them, the tutorials that I've seen that they don't 125 00:11:00,230 --> 00:11:02,060 take into account the minutes. 126 00:11:02,060 --> 00:11:08,090 And also we can also take here the seconds into account if we want to be really precise. 127 00:11:08,090 --> 00:11:14,840 But do not take just the few hours, take the portion of the hours as well as taking the portion of 128 00:11:14,840 --> 00:11:15,350 the minutes. 129 00:11:15,620 --> 00:11:23,660 And that's the way how you do it when you define a variable hours, taking the full hours out of the 130 00:11:23,660 --> 00:11:25,340 distance that it takes you to bef. 131 00:11:25,580 --> 00:11:35,150 So the full hour is three hours and then you take the remainder off of what is left for you and divide 132 00:11:35,150 --> 00:11:40,850 it by speed and minutes in order to get the time in minutes units. 133 00:11:40,860 --> 00:11:47,540 OK, so for that you calculated how what is your speed and kilometers per minute. 134 00:11:47,990 --> 00:11:52,400 Once you get the remaining minutes, you simply print the result to the screen. 135 00:11:53,150 --> 00:11:55,910 So as always, thank you so much for watching. 136 00:11:55,910 --> 00:11:57,110 Keep on practicing. 137 00:11:57,110 --> 00:11:58,070 You're improving. 138 00:11:58,310 --> 00:12:02,570 Also, we are recovering a lot of interesting things here. 139 00:12:02,570 --> 00:12:06,020 So until next time, I'll see you in the next videos. 14249

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.