All language subtitles for 006 Bank Management – Part 3 (Remaining Tasks)_en

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,360 --> 00:00:02,860 Welcome back now we're going to wrap up the remaining tasks. 2 00:00:02,880 --> 00:00:07,800 Let's read a unit test for this piece of behavior for a loan accounts, every withdrawal is charged, 3 00:00:07,800 --> 00:00:10,050 a fixed interest rate of two percent. 4 00:00:10,560 --> 00:00:14,500 So right here we'll create a unit test called withdrawal interest. 5 00:00:14,520 --> 00:00:16,230 I'll give you some time to write that out. 6 00:00:22,620 --> 00:00:27,840 OK, and now from the loan accounts, from the account and index two, we're going to withdraw. 7 00:00:29,110 --> 00:00:37,810 Twenty four, $434 point thirty one cents and the alone account is already twenty five hundred dollars 8 00:00:37,810 --> 00:00:39,730 in debt, so we can assert. 9 00:00:43,160 --> 00:00:44,280 A third equals. 10 00:00:46,020 --> 00:00:52,560 That after this withdrawal, the debt becomes five thousand twenty dollars point thirty one cents after 11 00:00:52,560 --> 00:00:57,690 we get the account's current balance counts at indexed to get balance. 12 00:00:59,150 --> 00:00:59,540 OK. 13 00:00:59,610 --> 00:01:00,380 Run the test. 14 00:01:02,930 --> 00:01:05,990 And it fails, but now we can write code to make it pass. 15 00:01:06,950 --> 00:01:09,490 So here I'm going to return true by default. 16 00:01:11,540 --> 00:01:17,810 We're going to update the balance super balance by getting the current balance super delegate balance, 17 00:01:18,440 --> 00:01:20,930 which for a loan account represents debt. 18 00:01:21,230 --> 00:01:27,410 So whatever the user withdraws will increase the debt and the debt equals whatever the amount is that 19 00:01:27,410 --> 00:01:28,130 they would draw. 20 00:01:30,310 --> 00:01:33,130 Plus, the interest, which is going to be that same amount. 21 00:01:34,500 --> 00:01:36,450 Times zero point zero two. 22 00:01:41,380 --> 00:01:46,840 And as always, don't forget to round to two decimal places, so here we're going to say super round 23 00:01:47,440 --> 00:01:49,120 and round our results. 24 00:01:52,600 --> 00:01:58,100 Now, do you see anything slightly wrong with this interest rate is an important value? 25 00:01:58,120 --> 00:01:59,770 So we're going to make this a constant. 26 00:02:01,030 --> 00:02:03,580 We're going to say private static. 27 00:02:04,480 --> 00:02:09,550 Vinyl double interest rate is equal to zero point zero two. 28 00:02:10,889 --> 00:02:12,570 And we're going to use the constant instead. 29 00:02:23,090 --> 00:02:24,620 If I rerun my unit test. 30 00:02:29,940 --> 00:02:34,370 Everything works now, our account is five thousand twenty dollars in debt. 31 00:02:35,690 --> 00:02:36,760 OK, we're almost done. 32 00:02:36,860 --> 00:02:39,080 We're in a writing test for this piece of behavior. 33 00:02:39,200 --> 00:02:42,560 So for a loan accounts, there's a withdrawal limit of $10000. 34 00:02:42,980 --> 00:02:46,070 So here we'll say well will create a unit test. 35 00:02:47,840 --> 00:02:52,100 And toll caps, I'm going to write the unit test would draw a limit. 36 00:02:55,880 --> 00:03:02,120 And from the savings account, which is that indexed to accounts at indexed two, I'm going to withdraw 37 00:03:02,570 --> 00:03:03,650 7000. 38 00:03:04,610 --> 00:03:08,570 $463 point 69 cents. 39 00:03:11,930 --> 00:03:16,040 But looking back, the loan account is already $2500 in debt. 40 00:03:20,070 --> 00:03:25,770 And the account isn't allowed to exceed $10000 in debt, so here I'm going to assert that nothing changes 41 00:03:26,280 --> 00:03:27,240 assert equals. 42 00:03:28,980 --> 00:03:34,800 The balance remains the same at twenty five hundred thirty seven point thirty one cents after we get 43 00:03:34,800 --> 00:03:36,030 that account balance. 44 00:03:37,090 --> 00:03:39,130 Counts to get balance. 45 00:03:41,050 --> 00:03:41,560 OK. 46 00:03:42,010 --> 00:03:43,000 Run the tests. 47 00:03:45,650 --> 00:03:48,120 And it fails, it does make the withdrawal. 48 00:03:48,210 --> 00:03:48,980 That's not good. 49 00:03:49,490 --> 00:03:50,510 So back here. 50 00:03:52,770 --> 00:03:55,710 We'll see if the balance, if the current dipped. 51 00:04:02,070 --> 00:04:03,180 Plus the amount. 52 00:04:04,540 --> 00:04:08,140 If it's bigger than the maximum depth, if it's bigger than 10000. 53 00:04:10,160 --> 00:04:14,870 If it's bigger than the maximum amount of debt a loan account is allowed to have, then we're going 54 00:04:14,870 --> 00:04:15,920 to return false. 55 00:04:17,130 --> 00:04:18,000 Nothing will happen. 56 00:04:18,959 --> 00:04:24,870 And instead of putting the rally 10000 directly here, I'm going to create another static constant private 57 00:04:24,870 --> 00:04:33,750 static final double max debt and set that equal to 10000 and use the constant instead. 58 00:04:38,500 --> 00:04:38,760 OK. 59 00:04:38,800 --> 00:04:41,950 This does remind me of something and checking together. 60 00:04:43,300 --> 00:04:45,850 We don't need to return true twice here. 61 00:04:46,450 --> 00:04:48,070 We can just return true at the end. 62 00:04:50,740 --> 00:04:53,920 Because if this executes, it's going to break the entire function. 63 00:04:53,950 --> 00:04:56,710 And if one of these executed, then it'll return true. 64 00:04:56,800 --> 00:05:01,620 So anyways, not a very big deal, but back here looks good. 65 00:05:01,630 --> 00:05:03,190 I think we can just run our test. 66 00:05:06,510 --> 00:05:07,320 And beautiful. 67 00:05:09,450 --> 00:05:14,310 OK, back in requirements text, it seems that we're done writing the logic for withdrawal. 68 00:05:14,490 --> 00:05:17,100 Now we're going to test the behavior for deposits. 69 00:05:17,700 --> 00:05:22,680 Now the logic for checking and savings deposits should be identical because you're just adding money 70 00:05:22,680 --> 00:05:23,400 to an account. 71 00:05:23,760 --> 00:05:28,230 So I'm going to create a unit test named deposit test. 72 00:05:29,020 --> 00:05:30,280 Public void. 73 00:05:33,210 --> 00:05:33,900 Deposit. 74 00:05:35,390 --> 00:05:41,570 And I'll deposit $5000 into the checking account, don't deposit 5000. 75 00:05:45,850 --> 00:05:47,110 And then I'm going to assert. 76 00:05:48,300 --> 00:05:53,670 But the resulting balance is six thousand five hundred and twenty four point five one. 77 00:05:54,120 --> 00:05:56,190 After we get the updated balance. 78 00:05:59,310 --> 00:06:02,100 OK, now we can write code to make it pass. 79 00:06:03,030 --> 00:06:04,170 So we'll go to checking. 80 00:06:07,550 --> 00:06:14,540 He will say super dad set balance will update the balance to be the current balance, super balance, 81 00:06:14,540 --> 00:06:21,170 plus the amount being deposited, and just don't forget to use Super Dot Round so we can ensure that 82 00:06:21,170 --> 00:06:23,420 we have two decimal places for money. 83 00:06:24,640 --> 00:06:25,240 OK. 84 00:06:25,660 --> 00:06:28,450 And we should be able to run the test now. 85 00:06:31,970 --> 00:06:38,720 And perfect now the deposit method for a savings should be identical to checking so we can just go ahead 86 00:06:38,720 --> 00:06:41,410 in savings and replicate the same logic. 87 00:06:41,450 --> 00:06:50,690 We'll go here, we'll say super set balance, super dot around, super dark get balance plus amount. 88 00:06:54,830 --> 00:06:57,710 All right, now, we got a ready unit test for loan deposits. 89 00:06:57,740 --> 00:07:03,200 The difference is when you deposit money into a loan account, your loan balance is decreasing. 90 00:07:03,620 --> 00:07:06,980 Think of it like paying your credit card in any case. 91 00:07:07,370 --> 00:07:09,980 We'll go back here and I'll create a unit tests. 92 00:07:12,740 --> 00:07:15,590 Public void named loan deposit. 93 00:07:18,220 --> 00:07:21,850 Inside, I'm going to make a $1000 deposit to the loan accounts. 94 00:07:23,250 --> 00:07:25,500 Accounts and index to. 95 00:07:26,610 --> 00:07:29,520 That deposit $1000. 96 00:07:32,230 --> 00:07:38,420 And after we're going to assert the resulting loan balance as third equals is one thousand five hundred 97 00:07:38,420 --> 00:07:39,880 and thirty seven point three one. 98 00:07:40,900 --> 00:07:46,000 After we get the updated loan account balance accounts at indexed to. 99 00:07:47,130 --> 00:07:48,690 Does it get balance? 100 00:07:54,610 --> 00:07:55,840 OK, the test should fail. 101 00:07:58,560 --> 00:07:59,040 Nice. 102 00:07:59,070 --> 00:08:00,900 Now we get to write code to make it pass. 103 00:08:01,320 --> 00:08:02,520 So right here. 104 00:08:03,950 --> 00:08:07,040 We'll just say super dad set balance. 105 00:08:10,980 --> 00:08:16,500 Well, around whatever calculation we do to two decimal places will get the current balance, super 106 00:08:16,950 --> 00:08:22,830 balance and subtract the amount that's being deposited, thus reducing the person's loan. 107 00:08:23,760 --> 00:08:26,130 OK, not to run the test now. 108 00:08:30,310 --> 00:08:31,140 Perfect. 109 00:08:32,020 --> 00:08:33,850 Now we're going to run every single test. 110 00:08:40,100 --> 00:08:45,020 They all passed, and that gives me great confidence that we implemented all of the meaningful logic 111 00:08:45,020 --> 00:08:46,070 without any bugs. 112 00:08:46,370 --> 00:08:47,090 That's perfect. 113 00:08:47,390 --> 00:08:51,890 We unit tested every single piece of behavior from the requirements and as long as every single test 114 00:08:51,890 --> 00:08:56,120 passes, I can rest assured every method is working the way it should. 115 00:08:56,690 --> 00:08:58,400 All right, let's move on to part four. 10203

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