All language subtitles for 017 Dealership Project - Part 2_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
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
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian Download
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,580 --> 00:00:05,290 You made it to part two, we got a bit sidetracked with delimiters, but let's continue building our 2 00:00:05,290 --> 00:00:06,270 dealership up. 3 00:00:06,939 --> 00:00:08,140 Here's what we have so far. 4 00:00:08,500 --> 00:00:12,550 The application asks the user to choose between buying a car or selling one. 5 00:00:13,000 --> 00:00:17,020 You chose option, in which case the princi boring message. 6 00:00:17,440 --> 00:00:22,120 And in this lesson, we're going to add some logic for Case A and the final result should look like 7 00:00:22,120 --> 00:00:22,680 this. 8 00:00:23,230 --> 00:00:27,660 If the client wants to buy a car, the program will check if the client can afford it. 9 00:00:27,850 --> 00:00:34,000 The client has insurance, the client has a license, and if the client has a good credit score and 10 00:00:34,000 --> 00:00:36,730 if everything checks out, the user can buy a car from you. 11 00:00:40,670 --> 00:00:42,600 First, we're going to be checking the client's budget. 12 00:00:43,070 --> 00:00:48,980 We're going to start by removing the Yuko's option, a text and on a new line, we're going to ask the 13 00:00:48,980 --> 00:00:49,460 user. 14 00:00:53,970 --> 00:00:55,050 What is your budget? 15 00:01:00,940 --> 00:01:05,860 Now, you might be thinking to use next double to pick up the value from the user, but honestly, you 16 00:01:05,860 --> 00:01:07,230 could use next double if you want. 17 00:01:07,240 --> 00:01:12,450 But when it comes to buying a car sensor kind of worthless, it's going to keep things as a whole numbers. 18 00:01:12,480 --> 00:01:17,920 I'm going to set a variable int budget is equal to the next in value that the user inputs. 19 00:01:20,170 --> 00:01:26,080 Great next into waits for the user to enter an integer and stores the value inside budget. 20 00:01:30,600 --> 00:01:36,810 Now we're going to check of the headlines, budget is at least ten thousand dollars if budget is greater 21 00:01:36,810 --> 00:01:42,510 than or equal to 10000, and if it is, the dealership will make them an offer will print. 22 00:01:44,750 --> 00:01:47,420 Great, a Nissan Altima is available. 23 00:01:56,050 --> 00:02:01,810 Otherwise, else, if the condition is false, the dealership will reply, we don't sell cars under 24 00:02:01,810 --> 00:02:02,500 10000. 25 00:02:10,759 --> 00:02:11,960 Rewriting my code. 26 00:02:27,190 --> 00:02:28,360 We'll say in a. 27 00:02:30,630 --> 00:02:32,190 Budget of 20000. 28 00:02:33,740 --> 00:02:35,800 And nice, a car is available. 29 00:02:41,870 --> 00:02:46,790 I expect this condition to be true so that the user is offered a Nissan Altima. 30 00:02:52,340 --> 00:02:57,710 Now we're going to be checking for insurance, a driver's license and a credit score, the user must 31 00:02:57,710 --> 00:03:00,660 have insurance and a driver's license in order to buy a car. 32 00:03:01,190 --> 00:03:02,710 So we're going to print two messages. 33 00:03:03,290 --> 00:03:05,870 The first message, we'll ask the user if they have insurance. 34 00:03:10,280 --> 00:03:16,760 We're going to insert a new line of space first again, and then we'll say, do you have insurance? 35 00:03:20,780 --> 00:03:22,630 Right, yes or no? 36 00:03:28,650 --> 00:03:34,380 And we're going to pick up the input using scan next line and stored in the variable string insurance. 37 00:03:42,050 --> 00:03:45,500 And the second message will ask the user if they have a driver's license. 38 00:03:48,450 --> 00:03:54,150 Once again, insert a new line of space and we'll say, do you have a driver's license, yes or no? 39 00:04:07,450 --> 00:04:12,100 And we'll pick up the input using scan next line and stored in the variable license. 40 00:04:15,370 --> 00:04:20,410 Before we run the code, I really hope you caught the next line trap because there's a next event that 41 00:04:20,410 --> 00:04:21,779 precedes your next line. 42 00:04:22,180 --> 00:04:27,490 And remember that the trap can happen when you add next line ahead of any of the scanner delimited methods 43 00:04:27,760 --> 00:04:33,280 in Long Doubler next, in which case your next line is going to get wasted on an empty line. 44 00:04:33,520 --> 00:04:39,250 And the workaround is to add a throwaway scanner next line right before the real next line. 45 00:04:42,710 --> 00:04:43,790 So let's run our code. 46 00:04:47,060 --> 00:04:49,850 Option a budget 20000. 47 00:04:51,400 --> 00:04:54,280 Yes, I do have insurance and yes, I do have a license. 48 00:04:55,690 --> 00:04:57,070 And it all works out. 49 00:04:57,980 --> 00:05:03,740 What happens is the proceeding next and only reads the value that it's interested in such that the throwaway 50 00:05:03,740 --> 00:05:06,690 next line picks up the rest of the line, which ends up being empty. 51 00:05:07,340 --> 00:05:10,550 And now the following next line is ready to read the user input. 52 00:05:11,780 --> 00:05:14,540 So some of you might be asking why I never you scanned next. 53 00:05:14,570 --> 00:05:19,600 And the reason is, as long as you can avoid this trap when it happens, you never really need to use 54 00:05:19,600 --> 00:05:19,970 scan. 55 00:05:20,210 --> 00:05:23,570 Next I like next line because it picks up the entire line. 56 00:05:23,570 --> 00:05:26,480 And I find that to be more fitting when you're picking up text. 57 00:05:28,890 --> 00:05:32,160 In any case, be careful not to fall into the scanner trap. 58 00:05:32,490 --> 00:05:36,720 I left this table for you in the next cheat sheet as well, so take some time to process it. 59 00:05:43,880 --> 00:05:47,370 And now finally, the client needs to have a good credit score to buy a car. 60 00:05:47,780 --> 00:05:48,770 So we're going to ask them. 61 00:05:53,910 --> 00:05:59,490 What is your credit score, and that's usually a whole number, so I'm going to pick up the credit score 62 00:05:59,970 --> 00:06:02,100 using scan next at. 63 00:06:08,860 --> 00:06:14,280 Now, a user can only buy a car if they have insurance and a license and a good credit score. 64 00:06:15,260 --> 00:06:20,330 A good credit score tends to be higher than 660, but I hope what I just said made you think of the 65 00:06:20,330 --> 00:06:21,450 end operator. 66 00:06:22,010 --> 00:06:26,690 So in our code, we're going to check if insurance equals yes. 67 00:06:32,990 --> 00:06:35,990 And if licence equals yes. 68 00:06:39,810 --> 00:06:43,140 And if credit score is higher than 660. 69 00:06:51,140 --> 00:06:52,040 We're going to print. 70 00:06:56,760 --> 00:06:57,400 Sold. 71 00:06:57,720 --> 00:06:59,270 Pleasure doing business with you. 72 00:07:15,990 --> 00:07:17,970 We're sorry you're not eligible. 73 00:07:23,640 --> 00:07:24,930 And that's really it. 74 00:07:25,450 --> 00:07:26,430 Let's run our code. 75 00:07:27,030 --> 00:07:30,300 We're going to choose option A 20000. 76 00:07:30,300 --> 00:07:31,330 Do I have insurance? 77 00:07:31,350 --> 00:07:32,670 Yes, a license? 78 00:07:32,670 --> 00:07:33,180 Yes. 79 00:07:33,540 --> 00:07:37,090 My credit score, let's call it seven hundred sold. 80 00:07:37,110 --> 00:07:39,730 Pleasure doing business with you in the airport. 81 00:07:39,760 --> 00:07:40,860 Looks very nice. 82 00:07:41,530 --> 00:07:46,560 There's just one thing I want to insert is just a line of space right before asking what is your credit 83 00:07:46,560 --> 00:07:46,940 score? 84 00:07:53,000 --> 00:07:54,350 I'm going to rerun my code. 85 00:08:01,280 --> 00:08:06,680 Seven hundred and perfect, it tells me a car, the output looks really nice. 86 00:08:07,700 --> 00:08:08,690 Hope I didn't lose you. 87 00:08:08,720 --> 00:08:10,670 Let's recap first. 88 00:08:10,670 --> 00:08:15,980 And if statement checks, if the budget is greater than 10000, if the user enters a budget of less 89 00:08:15,980 --> 00:08:16,850 than 10000. 90 00:08:17,120 --> 00:08:18,440 The condition is false. 91 00:08:18,440 --> 00:08:19,760 And Elsa runs. 92 00:08:23,190 --> 00:08:29,340 The condition is true if the user enters a budget above ten thousand, in that case, the first if statement 93 00:08:29,340 --> 00:08:29,970 runs. 94 00:08:35,059 --> 00:08:42,559 Inside the statement, the code picks up three values to strong values and an innate value, then a 95 00:08:42,559 --> 00:08:49,310 second, if statement checks for insurance, a license and a credit score above 660, since all the 96 00:08:49,310 --> 00:08:50,450 comparisons are true. 97 00:08:50,660 --> 00:08:52,250 The entire condition is true. 98 00:08:52,250 --> 00:08:53,660 And Java sells them a car. 99 00:08:54,940 --> 00:08:59,530 Now, try entering values that would cause one of the comparisons to be false and see what happens, 100 00:08:59,530 --> 00:09:00,640 play around with the code. 101 00:09:02,990 --> 00:09:08,120 In this lesson, you added the logic for buying a car, if the user chooses option, the program will 102 00:09:08,120 --> 00:09:09,890 check if the client can afford it. 103 00:09:10,960 --> 00:09:16,000 The client has insurance, the client has a license, and if the client has a good credit score. 104 00:09:18,680 --> 00:09:21,530 In this leaves us with a very nice aput. 9720

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