All language subtitles for 12. Challenge 3 - Solution 2

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
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

Original subtitles

Mark Colvin.

What is going on, guys?

So let's get down to business right away.

We need to create three great variables, grade one grade, too, and grade three.

So for that, we'll use in grade one.

Great.

Two and grade in grade three.

Semicolon at the end.

Control, as we say.

Now, let's print some nice message in which we will ask the user to insert its first grade.

So we'll use something like print F, enter grade one.

And now let's read grade one from the user and put this value inside of variable grade one so we can

do it by using scan F, scan F percentage.

The because we are using we are reading an integer value and we will place it inside of the address

where grade one resides.

All right.

This is good.

Now let's do the same for both the grade two and grade three.

OK.

So copy paste and copy paste.

Print F, enter a grade two and the same here.

Great.

Two in here will enter a grade three and read the grade three.

There you go.

Also, let's define here another variable called average.

And we will set it to be of type double.

So use double average.

This variable should hold the average of the three grades we've just read from the user.

All right.

So at this point, we can basically say that the average of the previous three grades read here on this

line of where we used scan F, the average should be something like that.

Average equals two.

Let's some all of the grades.

So grade one plus.

Grade two plus.

Grade three.

Right.

And just divided by three.

Semicolon at the end.

And now let's think will it work?

I want you to pause the video and take a second to think about it.

So the answer to this question is absolutely no.

Because we've just talked about how important it is to use casting.

To get the exact grade, assuming it may maybe a floating point type.

And we've learned a couple of ways in which we can accomplish that.

So in this example, we can see that on the right side of the equation in line 14.

You can see that both the participants on the right side here.

Right.

Here is the three end.

Also, all of these some both of them are basically integers.

And we know that the result of these mathematical operation, we've said it previously in there in the

video where we discussed casting, the result of that is also going to be of type in nature, meaning

that if we get here on the right side, an average grade of something like eighty five point seven,

if we should get this value, basically it will be just rounded to eighty five.

And then we lose the whole point of using these exercises.

So for that, we need to use casting.

And basically we should simply define one of these.

Or a numerator or denominator to be of type of type double or a floating point type, for example.

So the easiest way to do it when we can simply just add a dot zero at the end.

And what we've basically done here is we simply say that these value, instead of using three, as it

was previously, just an integer, that this value is of ways of a floating point.

And this means that the result of this whole operation, of this whole day vision, of this sum by these

three point zero, the result of eating is also going to be by default.

It's also going to be of a floating point type.

And that's exactly what we want to do.

So let's now print the result, print the average grade.

So print F average equals two percentage left because we use double.

Actually, there is no real Nessus.

Nicest necessity to use double here.

We can basically just use float.

But let's leave it as is for now.

And here we will use the average semicolon at the end here.

All right.

Now let's build and run it.

Oh, and we have a little problem here.

Was the problem in line 14 average equals to grade one plus grade two plus rate.

Oh, I forgot the three here divided by three point zero.

All right.

So now it should be good.

Let's save it and build and run it once again.

There you go.

Here is our consular application.

Now, let's use some example here.

Let's say it was the first.

Wade was 80 and then we had 60.

Then we had, I don't know, ninety five.

So every time you pressed enter, I just just to remind you guys, the number itself you pressed here

was inserted, was placed inside of the corresponding variable.

So in this example we had one and then grey two and then grade three once we pressed the enter right

now.

So let's press that.

And there and there you go.

There is your average grade equals to seventy eight point three three three.

We can limit that by placing here DOT two.

And also, of course, let's add a backslash in the end just to separate separated from the default

text.

Let's build in running once again executes something like 75, 65 and 200.

Let's do it like 97.

Larry, go seventy nine point zero zero.

We'll limited it by putting a DOT two, which simply says you can place just two digits after the floating

point.

All right.

So we almost finished this exercise.

Just one last thing that I want to show you guys in this example.

We can also leave the three, as it was previously, as an integer, and instead we can just think any

of these variables here on the left side.

We can take any of them and just cast them to be of type double.

This basically will be enough for for the whole operation, for the whole math operation to treat it

as a floating point number so we can basically do something like that.

Just add here double casting and now all of your result will be treated as a floating point and it will

work okay without any round to the smallest integer.

You can also do the same for the second for the OP's.

Sorry about that.

There you go.

You can also do it for the second grade.

It doesn't matter.

Okay.

So basically, I hope you've got the idea of how to use casting and you practice it with this nice little

exercise of using three grades.

And actually, yeah, I can say that I think that you're ready to move on to your next milestone.

And actually, the next milestone is very interesting milestone because you will develop in this milestone

a weather station.

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