00:00:01
Yes Welcome everyone to the recording And today
00:00:05
we have such a fairly extensive lesson
00:00:08
Even though we have a new topic
00:00:11
a small one is planned Well, that is, I think
00:00:14
Well, it won't take that much
00:00:17
time but you still want
00:00:19
show more code today and to
00:00:22
here's how to delve into this even more
00:00:25
topic of separating code into methods and so that
00:00:29
you seem to have put it off more and more
00:00:31
I don’t know if we’ll have time to get there today
00:00:35
such an important big part let's see how
00:00:38
everything will go like this and we'll see how
00:00:42
I wonder how it will all be, but I hope something
00:00:45
let's go again the important part
00:00:47
which I planned today she
00:00:50
today for those who will start from scratch
00:00:52
more as a reminder
00:00:55
you will have no homework for this
00:00:58
part of the lesson if we get to it here
00:01:02
it will be greater for those who already
00:01:04
seems to have gotten the hang of it and can easily complete the first one
00:01:07
part of the work Here are homework and how
00:01:12
would be ready for the big ones
00:01:14
experiments Well, from the next lesson
00:01:18
we will completely switch over to that
00:01:21
most of the second part that I am today
00:01:23
I plan to also want to say that
00:01:28
first of all I really really want to
00:01:30
please emphasize everything a lot
00:01:33
Dear Beginners Who came with
00:01:36
absolute zero please keep in
00:01:39
I see that for you it’s like your main
00:01:42
the goal is to make the first part homemade
00:01:45
work, everything else is still up to you
00:01:49
grew up for you to just watch so you
00:01:52
we understood that it was like being in a car
00:01:55
testing there is a task not only
00:01:58
from the first part but the first part This is
00:02:01
You must master to prepare for
00:02:04
auto testing here's what else
00:02:07
I would like to say that if any of you
00:02:10
is far behind the program there
00:02:13
on time or joined later
00:02:16
please keep in mind that now
00:02:19
our topics will be just like boom-boom-boom
00:02:22
one after another and you have to keep up and what
00:02:25
you might be here just this week
00:02:28
it remains for you to catch up
00:02:30
my idea of how to catch up with this
00:02:34
I would like to watch all the videos and try
00:02:38
complete the first part of each homework
00:02:41
which you have not yet completed
00:02:42
second third If you're late Bye
00:02:45
don't even touch it, that is, you can
00:02:48
see analysis But honestly not even yet
00:02:51
waste time because you just don't
00:02:54
you will have time to build for testing That is
00:02:56
if you sit down like this, you won't
00:02:59
you have time and you fall behind, you are no longer
00:03:02
you will have time to integrate into the project because
00:03:04
well, everything will be very active now
00:03:08
and we have more important topics that
00:03:11
you need to master that is, very, very
00:03:13
I advise you to spend more time If you
00:03:16
still want to integrate into the project If
00:03:19
If you don't want anything bad, then go
00:03:21
at your own pace If you want it, it’s not like that
00:03:24
a lot of time for catching up and
00:03:28
lag and how you need to take yourself
00:03:31
in your hands you will literally have this
00:03:34
perhaps one more week to
00:03:36
have time to catch up, swing and, as it were,
00:03:40
it’s better to keep up further because there
00:03:42
right here Well, really, we’ll start to have something like this
00:03:45
topics that are absolutely necessary at least
00:03:48
listen at least a little
00:03:49
practice and then it will begin
00:03:57
stranded these are all the topics that
00:04:00
definitely for you definitely need
00:04:03
get in step with the whole group here
00:04:06
because otherwise you'll miss it
00:04:09
the moment of integration into the project will come later
00:04:11
very difficult to fit in
00:04:13
And what else did I want to say? oh well
00:04:18
still concentrate on
00:04:20
first part of homework today I
00:04:23
I will try to give you much more
00:04:25
examples as if to perform the first
00:04:27
parts of homework that is, so that these
00:04:30
the examples were similar to the task from the first
00:04:33
parts so you can do something
00:04:35
navigate When you do the first
00:04:38
some of the homework is also very
00:04:40
I hope that all of you who wanted to get
00:04:42
groups got here if we let’s say
00:04:46
there are a huge number of people who would
00:04:49
I wanted to get into the group but at the same time
00:04:51
Let's say there's no place in the groups anymore, you're not
00:04:54
got it, let's discuss it on telegram
00:04:56
maybe we can come up with something there
00:04:58
But if there are a few such people
00:05:02
Well there maybe however how they be extra
00:05:05
the group will be full Well, let's do it
00:05:08
We'll discuss everything after the lesson on telegram.
00:05:10
yes this is not the topic of today's lesson
00:05:13
Well, what do we start with? I mean first
00:05:18
to put together a little bit of everything that we are
00:05:22
we went through this before and it’s like
00:05:26
let's try it out a little bit
00:05:30
it seems like there were a lot of topics and
00:05:33
it seems like we talked about each other separately
00:05:36
a lot of things, but I want this
00:05:40
together And now you will have a week for this
00:05:43
mastering So let me start right away
00:05:48
right away, that is, I’ll expand the screen now
00:05:57
everything seems to be ready
00:06:01
so I neck the screen
00:06:06
yes yes yes yes this is our task
00:06:12
the next ones will be for now, I'll remove you so they
00:06:16
they weren’t embarrassed by it, as if on the next
00:06:19
topics and now I would like to still
00:06:23
I looked at it a little today
00:06:25
analysis of homework and here's one task for me
00:06:28
I was very confused and didn’t make it onto the recording
00:06:32
code How I would like it to hit
00:06:35
So now let's go straight
00:06:38
I'll go here, open my homework and let's
00:06:43
together we will write this code at the same time
00:06:46
Let's remember what methods are and how they are all
00:06:48
it's written like that and it confused me 14
00:06:58
and now we’ll try to write together
00:07:02
I don't know, saw, didn't see, but I just
00:07:06
when I went and copied the task like this
00:07:09
now let's try to write together
00:07:11
this code firstly let's see
00:07:16
to the conditions of the problem That is, we have
00:07:19
some expressions and some KLM parameters and
00:07:24
look at our expression, that is, here
00:07:27
you always have to look very carefully
00:07:29
on what you need to print and what you
00:07:33
need to be printed so here is ours
00:07:36
expression they are almost identical
00:07:39
each other, that is, absolutely identical
00:07:43
and according to the actions that need to be displayed by
00:07:47
results of actions that need to be taken
00:07:49
display everything that seems different between us
00:07:52
these are the parameters that is the name
00:07:55
parameters and, as it were, accordingly
00:07:58
the parameters that we will put into this method
00:08:00
send and print but really to
00:08:05
print each of these phrases We need
00:08:08
only two parameters
00:08:10
you see only two parameters at the same time
00:08:13
it can be either Key or
00:08:20
that is, these are just two parameters
00:08:26
work, that is, in which we must
00:08:30
calculate the result of division and remainder
00:08:34
So let's now make a method
00:08:39
so that we already have it
00:08:42
and as it were, we write methods in the house
00:08:47
here I'll start writing here and there
00:08:51
let's make a public by the way method for now
00:08:54
all our methods were public Static howls
00:08:58
then today that's what we will be
00:09:02
do Let's call him there not
00:09:07
lla principle It doesn’t matter what it’s called
00:09:10
that is, the main thing for us is that KLM is here
00:09:16
we will take some action
00:09:18
performing actions is action
00:09:23
And as we already said, actually for printing
00:09:27
of each expression We only need two
00:09:29
parameter and I think we had them there
00:09:36
we do that is, we essentially
00:09:40
one parameter and a parameter
00:09:47
times two that is exactly the meaning
00:09:55
By the way, I highly recommend that Java can do it
00:09:58
check here showing through and on through and
00:10:02
to naturally through and here and Yes too
00:10:06
screw parameter 2 That is, we will have
00:10:09
only two numeric parameters because
00:10:11
in one sentence We only need two
00:10:15
We don’t have a parameter to print it
00:10:19
you need to put all phrases into one method
00:10:22
because they are absolutely identical to us
00:10:25
you need to print each phrase separately
00:10:27
method 4 times So that's two times
00:10:32
parameter but look at us in this phrase
00:10:35
we still have to How would the name of these
00:10:38
parameters prints that is, their value
00:10:40
namely the name, that's why we'll do it
00:10:44
two more parameters 3
00:10:46
and accordingly we will allow this
00:10:50
there will be some take there was one
00:10:57
and we’ll make the same string I believe 2 that is
00:11:03
two names of parameters that
00:11:06
we have to insert this into this phrase Well
00:11:09
that's all, that's what it is
00:11:11
will come to us at the entrance and what we need
00:11:13
to print one phrase Here you go
00:11:17
accordingly we need to divide the first
00:11:20
parameter to the second Yes and count the remainder
00:11:24
from dividing the first parameter by the second
00:11:27
parameter Well, here's all we'll do
00:11:30
do we will print our phrase not
00:11:34
I always like to print like this
00:11:36
because to me but these are purely mine
00:11:39
you can see better what's inside me
00:11:43
Although I will repeat your future work again
00:11:47
You won't be printing anything at all.
00:11:50
today it’s as if we already have
00:11:52
there will be a task
00:11:55
Once upon a time, do your homework
00:11:58
tests without printing the result
00:12:01
and printing the result
00:12:04
testing which is a little different but
00:12:06
today we'll talk about it So that's it
00:12:09
we will print here The first one is with us
00:12:12
the result of division comes
00:12:15
we actually do the division result
00:12:18
next we have to insert the name
00:12:26
Next we have the word on
00:12:32
like this with two spaces so that
00:12:36
everything was separated further the name of the second
00:12:40
parameter and equal
00:12:47
here And here we must insert the result
00:12:50
I'll go straight to the new one here
00:12:53
line means where we can get the result
00:12:55
In principle, we can stick it right here
00:12:59
calculation But we can
00:13:02
and separately calculate that, but let me not
00:13:07
I know, in principle, let's do it separately
00:13:09
just to understand the result
00:13:12
calculations we will have some
00:13:14
parameter one Well, let's say division is y
00:13:34
That is, this is the result of division
00:13:38
first parameter by 2 and required
00:13:40
you need to divide exactly the first parameter
00:13:43
which came on the second parameter
00:13:47
This is exactly what we are
00:13:52
paste it here and that's what it will be
00:13:56
the result of dividing the first parameter by 2
00:13:59
whichever 1 2 came with whichever
00:14:02
the names they came we will be just
00:14:04
divide the first ones by the second ones
00:14:07
account 1 which comes to the second method
00:14:11
and accordingly the remainder of the division we
00:14:15
let's do one more calculation
00:14:20
That's exactly the same way we do parameter 1
00:14:30
percentage sign divided by parameter 2 and
00:14:38
here we inserted the result exactly
00:14:41
division, that is, next we need
00:14:44
insert this comma and actually
00:14:48
that's right up to
00:14:51
Ellipsis we need to insert the following
00:14:55
I will insert the phrase on separate lines
00:15:01
let's do it so that
00:15:04
two different phrases and accordingly
00:15:12
so that's it, that's basically it, look at it
00:15:18
that is, now our method will accept
00:15:21
two clock parameters and accordingly
00:15:26
it will print both the title and
00:15:30
the results of some calculations and
00:15:33
this is actually his
00:15:36
like a destination Here we are
00:15:40
we call, that is, let us first
00:15:43
Let's create some parameters, that is, Us
00:15:46
you need the parameter kay Well, let's say 20
00:15:53
Let him be there 10
00:16:01
here are our three parameters, come on
00:16:05
let's make it five to make everything beautiful
00:16:07
was So and accordingly we are now
00:16:13
we print, that is, we call our method
00:16:19
and we hand over first from us we hand over
00:16:25
that is, we convey what lies
00:16:28
the Key variable is what is in the variable
00:16:36
and the name of the variable L is output here
00:16:43
this is all to print and see what
00:16:48
and we see the result of dividing kei by L
00:16:51
is equal to 2 and the remainder of the division is 0 Well
00:16:55
yes, in principle everything is correct then exactly
00:16:58
so what do we need Kane there?
00:17:02
call the same method you see like this
00:17:05
as the action is the same we don’t need
00:17:07
write as if there are many actions in one No
00:17:10
one just call one four times and
00:17:13
the same method that works with these
00:17:16
actions and again I forgot what was there
00:17:19
there was a movie, that is, we pass on what lies
00:17:23
the variable Key is what the variable m lies in
00:17:26
name kay and title
00:17:35
So please see the answer, and
00:17:40
accordingly, and so on. That is, he sat down
00:17:42
on m that is, the idea is clear that we, as it were,
00:17:48
lose our actions which we
00:17:52
must be performed on such point
00:18:00
So call these methods many times
00:18:05
so that we can complete some
00:18:09
the same actions, well, and accordingly
00:18:13
so we won’t print further then
00:18:16
is there any on this part? Are there any
00:18:19
turn on the microphone directly asks No
00:18:24
Yes, I just wanted it to be exactly like this
00:18:27
a piece of the year was recorded so that you
00:18:30
as if you saw that when we have
00:18:33
absolutely the same actions
00:18:35
repeated many times only change
00:18:38
parameters let's see how many parameters there are in
00:18:41
one action and, accordingly, all this
00:18:44
we take out exactly in one small
00:18:46
action and call it four times
00:18:48
instead of writing a big method
00:18:52
where the same thing is done four times
00:18:55
we need to select small No it is
00:18:58
always call it four times
00:19:00
we prefer the small point method
00:19:03
This is also correctly called a single
00:19:05
press pants on the ticket, that is, single
00:19:09
responsibility and that's if we have
00:19:11
some action that is absolutely
00:19:13
the same thing is done many times, here's how
00:19:16
once this action takes out the method we
00:19:20
we try to make a huge method
00:19:22
which inside which will be very
00:19:24
a lot of repeating things but in the future
00:19:28
we'll be like the rest of the time
00:19:32
we will only learn to work with that
00:19:35
how to correctly render methods like
00:19:38
correct how to design How
00:19:40
that's right, this one
00:19:42
responsibility to do that
00:19:45
accordingly this is what ours will be about
00:19:48
testing including project plus
00:19:51
there are still some additional things
00:19:54
So let's move on then if everything is clear
00:19:57
If there are no Questions, Move on, that means
00:20:03
let's move on to the presentation
00:20:18
went there Where is my presentation Here it is
00:20:22
visible yes presentation
00:20:26
today we will expand a little
00:20:31
concepts of methods that is first
00:20:33
theoretically then practically that is
00:20:36
so far, as I said, we had methods
00:20:40
public Static your static is not for that
00:20:44
so that we can then in the Main method
00:20:47
call that is, we take it out as a method
00:20:50
Main by the way means that they are starting
00:20:53
they belong to some class
00:20:57
I don’t know a certain object or there
00:21:00
they are written simply inside the method
00:21:03
inside the method there are other methods to write and
00:21:07
it’s impossible, that is, we take them outside
00:21:10
we and For this we need to do Static and
00:21:13
then we can call them inside
00:21:15
method so that they give us something
00:21:18
calculated, that is, the word statics
00:21:20
means that a method or variable
00:21:23
belong to the public class word public
00:21:28
this is a word that means that our method
00:21:32
or the variable will be absolutely visible
00:21:34
everywhere inside our project And as if from
00:21:39
we'll talk about other options later
00:21:41
while we are all doing no public
00:21:43
we worry about it later
00:21:46
let's use a different concept at least
00:21:49
one thing and then we’ll see what else and
00:21:55
the next word is public statics
00:21:57
you already understand what public is
00:21:59
so that you can see it everywhere Static is so
00:22:02
the method began to belong to the class and
00:22:06
so that we can call it inside
00:22:10
So now as for the word Voight
00:22:15
now we are going to our presentation then
00:22:20
there is this is our little plan Yeah well here we go
00:22:22
we see that the method is some blocks of code up to
00:22:28
run when they just run that code
00:22:32
inside which we write only then
00:22:35
when we call this method That is
00:22:38
while the method was written, we did not call it in
00:22:41
method May it doesn't work at all This
00:22:44
just a piece of code we wrote
00:22:47
for future use but it doesn't
00:22:50
doesn't work but as soon as we get it
00:22:53
call inside the method we it starts
00:22:55
work count there or do those
00:22:59
actions that are written inside him
00:23:02
this method This is how it will be in the future
00:23:06
look almost always Our tests
00:23:09
or ours it will be some kind of chain
00:23:13
sequentially calling some
00:23:15
methods, that is, mainly ours
00:23:18
programs Our tests will look like
00:23:20
exactly like this, that is, we will just
00:23:23
call some methods sequentially
00:23:27
solely responsible for implementation
00:23:30
small actions and we will be these
00:23:33
methods to collect
00:23:34
our future code is like this
00:23:38
Lego constructor when we string here
00:23:42
these Lego blocks one on top of the other on top of the other
00:23:45
and in the end we get some kind of figure
00:23:48
or like the bricks that we customize
00:23:51
one on top of the other and we get a house there
00:23:55
that is, take out one brick of the whole house
00:23:59
will also fall apart here as if to pull it out
00:24:02
marks and in the end we won’t go as if
00:24:05
there's nowhere else to go, so let's talk first
00:24:08
a little about methods
00:24:10
and now our task is to understand the difference
00:24:13
between the word Voight and other words
00:24:16
which can be in place of the word then
00:24:19
there is a public page by the way, yes And now
00:24:21
we'll talk about how there are such methods
00:24:26
they don’t return anything there is such a concept
00:24:30
as if they don’t return any pouring here
00:24:33
In Java this concept is denoted by the word
00:24:37
howl and Until today we seem to
00:24:41
spent a whole week writing the methods we have
00:24:44
didn’t return any money, that is,
00:24:48
all our methods were wars, they were nothing
00:24:51
returned Why Because everything
00:24:54
we simply printed the results inside
00:24:57
the method itself, that is, we simply took
00:25:00
some calculations and printed them again
00:25:03
took some calculations and printed
00:25:05
The maximum we could with this method
00:25:08
let's say there is inside a method
00:25:11
some value of the variable which
00:25:13
visible from outside the method and then we called
00:25:17
the value of this variable which we
00:25:19
changed inside the method and accordingly we
00:25:22
saw a new value and checked it but
00:25:25
anyway, we have the method itself
00:25:27
didn't return anything, that is, he just
00:25:30
something inside believed he appropriated something new
00:25:33
the value of another variable and, as it were, Everything
00:25:36
that's where its function ended
00:25:39
now we will study first
00:25:42
distinguish between methods that are something
00:25:44
returns methods that have nothing
00:25:47
return and secondly how to write
00:25:49
such a method that will already be something
00:25:53
return So let's say we have
00:25:56
some task to go to
00:25:59
that is, this task is like a task
00:26:03
from life we will try to divide into some
00:26:06
methods and on certain parameters So
00:26:09
let's let the back go to and we have, as it were,
00:26:14
the parameter guests parameter is substituted in
00:26:17
grandmothers are there to visit grandmother in the village
00:26:20
and that is, something like this
00:26:23
definition of this problem go to and here
00:26:27
accordingly we can
00:26:29
divide into some tasks then
00:26:32
there are some small methods
00:26:34
which we can highlight these methods
00:26:39
responsible for a certain part
00:26:41
logic for example First we select
00:26:45
the task of getting on the train
00:26:48
get off the train Well at your destination
00:26:55
stay at grandma's house with all my heart
00:26:59
given there are pies, that’s another task and
00:27:03
then we get on the train again and drive through those
00:27:06
800 kilometers from home and we go to
00:27:08
destination stations
00:27:10
if please note that this is
00:27:12
the task is absolutely identical to this task
00:27:16
We're just going in the other direction, but we
00:27:19
in the same way we get on the train and pass
00:27:21
the same 800 kilometers and we leave How
00:27:24
just getting to our station
00:27:27
destinations That is and If we talk about
00:27:31
symbol of the press card, that is, about
00:27:34
single responsibility then we have
00:27:36
the task is to get somewhere from somewhere
00:27:40
and the task of visiting, that is, two different
00:27:44
tasks that don't overlap
00:27:46
with each other and, accordingly, these
00:27:49
here are the tasks the first task is to get somewhere
00:27:52
we call twice just change
00:27:56
parameter that we are not going from point B A
00:28:01
let's say we're going back already We're going from point B
00:28:03
point, but at the same time we have the same
00:28:07
the task is to change only the parameters
00:28:10
Well, here’s the task of visiting, we call her
00:28:13
once because yes we arrived
00:28:15
stayed for a while and went back, it’s already bigger
00:28:17
not at a party, but at home, let’s say further
00:28:21
the same similar task to go on a visit
00:28:24
we can let her in with her friends
00:28:28
supplement with some other tasks
00:28:31
in particular, look, we get into the car
00:28:34
we drive 50 kilometers and get off at the point
00:28:37
destinations next, we are guests at the dacha
00:28:40
friends and get back into the car
00:28:43
we drive quietly for 50 kilometers and get out
00:28:45
but please note that we are on the train
00:28:49
we were driving in a car, that is, the actions themselves
00:28:53
we have absolutely identical, that is, the same
00:28:57
the task is to board the train that we allocated
00:29:00
here we can apply it here
00:29:04
only with a different machine parameter like
00:29:07
we call the vehicle
00:29:10
So we travel another distance and
00:29:13
accordingly, destinations can
00:29:15
be different Yes, but the task itself remains
00:29:18
one and the same, that is, we can definitely do it
00:29:21
we can also reuse it only
00:29:23
we must understand that we are different here
00:29:26
parameters train car Here or there
00:29:30
any kind of transport at all, that is
00:29:32
here it is, it’s the same task, that is
00:29:35
which takes parameters as input
00:29:38
transport and distance Well, maybe still there
00:29:41
points A and B are precisely defined from where
00:29:45
we're going where we're going
00:29:48
and accordingly the whole task is
00:29:51
is that we are sitting down somewhere
00:29:54
we drive the distance and leave our
00:29:57
vehicle like this
00:30:00
we will highlight the universal task in
00:30:05
that is, it is the task of life to go to
00:30:09
some kind of transpo Here But exactly the same in
00:30:13
in Java we will look for these
00:30:16
small subtasks that we can
00:30:18
use many times they are logical
00:30:21
are responsible for only one action
00:30:26
accordingly, these are the tasks we
00:30:28
we will separate them into separate methods and
00:30:31
we will call these methods a lot
00:30:33
times Then inside the program only changing
00:30:37
the parameters are exactly the same as us
00:30:39
Now we have done this with our method
00:30:41
here is the calculation of the remainder first, or rather
00:30:45
first the division results and then
00:30:47
remainder from division only with different
00:30:49
parameters This was our task
00:30:52
which was logically combined and
00:30:57
was responsible for a specific unit
00:31:00
responsibility we caused this task
00:31:02
four times just changing the parameters
00:31:05
variable name Exactly the same
00:31:10
In what place and with what owners Yes it is
00:31:13
maybe we're visiting grandma's village
00:31:16
or let's say we're visiting friends' cottage
00:31:19
or there is a sanatorium I don’t know from the owners
00:31:23
We are also guests of this sanatorium
00:31:25
even though we pay money, but this
00:31:29
some kind of task to visit or
00:31:31
to visit there to stand there in some
00:31:34
place Yes, how we stood there, and
00:31:37
accordingly we can highlight there
00:31:39
separate for tasks, that is, to relax
00:31:41
to eat we can put them in one
00:31:45
We can take care of the common task separately
00:31:47
there are still some actions to perform and
00:31:50
separate methods for these small ones
00:31:52
to the task Well, the main thing is to understand that
00:31:55
the task of rest is different
00:31:59
logically the task is to eat if we
00:32:02
you need to somehow define it separately
00:32:05
Let's say the task is to eat. Eat what's there.
00:32:08
borscht or cutlets or eat there
00:32:12
I don't know, some kind of grandma cake
00:32:14
baked That is, accordingly this
00:32:17
her other task may change
00:32:19
we can separate the parameters into separate
00:32:21
method but this task has nothing to do with
00:32:25
another task which is to relax
00:32:26
relax is more like taking a walk there Yes there
00:32:29
sit somewhere I don't know relax
00:32:32
sleep in the end, that is, and in
00:32:36
in the end, we seem to be creating some kind of
00:32:39
method We are going Yes and there We are transferring
00:32:43
certain parameters that we
00:32:45
generally needed to do everything
00:32:47
action that is, please note the general
00:32:50
a method that collects many small
00:32:56
that is, the general method that we collect
00:32:59
we have these little methods
00:33:02
does not accept as parameters
00:33:05
only those parameters that are needed for
00:33:07
one task but all the parameters are
00:33:10
needed for all the small subtasks inside
00:33:13
this one big method, that is, we
00:33:15
unite we do some we can
00:33:18
combine our small methods into one
00:33:21
a big method that will logically
00:33:24
be responsible for some kind of general
00:33:28
the task of how to arrive somewhere something there
00:33:32
do it and go back, that is,
00:33:35
accordingly, here you go, ours
00:33:37
small task to travel which includes
00:33:41
there are machine parameters and 800
00:33:45
kilometers, let's say stay at home
00:33:48
grandmothers go back to the car 800
00:33:53
kilometers but the same general method
00:33:56
We are traveling with the parameters, let's say the train
00:34:00
thousands of kilometers
00:34:05
what are distant relatives like, their home?
00:34:09
and Here accordingly with these parameters
00:34:11
we can already use it as if with
00:34:15
by others for another task, a common one
00:34:18
big but still small
00:34:20
subtasks will be sorted out by these
00:34:22
parameters that are needed for execution and
00:34:26
will sort of fulfill their little
00:34:28
actions at the right moment from above
00:34:32
down from left to right in the code we have everything
00:34:35
carried out that is, at the right moment They
00:34:37
will launch execution of some kind
00:34:40
subtasks this will take away under tasks
00:34:44
parameters that are necessary and will
00:34:47
perform this general action
00:34:49
there's somewhere to go far there's something there
00:34:52
go stay and come back
00:34:55
But this is such a slightly funny example
00:34:59
there will be another funny thing in life now
00:35:01
example, that is, an example of preparation
00:35:03
sandwiches here Maybe we're like
00:35:06
Let's understand more what the difference is exactly how
00:35:09
not how we formulate methods, but
00:35:14
tasks that return something from tasks
00:35:18
which return nothing So the recipe
00:35:21
sandwich with sausage which is taken from
00:35:23
Internet, here's even a link
00:35:25
It turns out that people even have such recipes
00:35:28
they write, well, and accordingly we have
00:35:30
some ingredients bread one piece
00:35:33
sausage one piece So there is something
00:35:36
Description of action Take a piece of bread
00:35:38
cut a piece of sausage, put the sausage
00:35:41
ready for bread That is, this is real
00:35:44
recipe from the internet let's try it
00:35:47
translate into code Here, accordingly, we have
00:35:50
there is some class
00:35:52
we immediately remember that in general Now we
00:35:56
can only write in class Here we are
00:36:00
creating some kind of Layer where we will be
00:36:02
create some methods and that's it
00:36:05
accordingly, let's say there is a class there
00:36:07
sandwich or eye make a sandwich everything
00:36:10
depends on that there I don’t know what you are
00:36:13
do Yes And look, there is a method
00:36:17
take We take some ingredient Yes and
00:36:21
actually Well, that is, we convey some
00:36:23
ingredient in this method and that's it
00:36:26
everything we do we take this
00:36:28
ingredient inside this method
00:36:31
went to the refrigerator and took the ingredient
00:36:34
which is necessary
00:36:35
applied to life, the method of cutting something off
00:36:39
yes, let's say we send some kind of stuff there
00:36:41
the ingredient is bread or sausage, it doesn’t matter And
00:36:44
what's there? We cut, that is, not only do we
00:36:47
we then took this ingredient and
00:36:50
cut off a piece thanks to this
00:36:53
cut further method
00:36:55
guess that is, we take one
00:36:58
cut off ingredient and place on another
00:37:01
cut off ingredients as if yes
00:37:04
depends on the order and the application of these
00:37:10
Matroskin the cat would rather have that sandwich
00:37:13
which is sausage down here But usually
00:37:15
accepted like this, sausage side up
00:37:17
fold but everything seems to be very strong
00:37:20
it depends and in the end here we have
00:37:24
some small subtasks that
00:37:27
then we can use it for different
00:37:30
ingredients in certain
00:37:32
in a certain order and ultimately receive
00:37:35
a specific sausage sandwich and here it is
00:37:38
please let's make a sandwich with
00:37:40
sausage is a certain general method that
00:37:43
in the end it accepts let's say it's written that
00:37:47
Yes, he still accepts entry
00:37:49
ingredients bread sausage Yes and what we
00:37:55
cut off the sausage and place the bread on
00:37:59
sausage let's say we already have a piece of bread
00:38:02
cut we don't need to cut it What if
00:38:05
if we had to cut it, we would have done it twice
00:38:07
let's say they would use it, well, take the bread
00:38:11
cut off the bread take the sausage by the way too
00:38:16
Yes, this piece was missed. Well, that is, If
00:38:20
let's dig into the order of action then we
00:38:22
we see that if we painted according to
00:38:25
if all these actions are correct then we need
00:38:27
there would be much more, that is, we should
00:38:29
were Take bread take sausage cut
00:38:33
bread cut off the sausage and put the bread on
00:38:37
sausage or put sausage on bread
00:38:40
depending on the order of the ingredients and
00:38:43
what will we end up with if everyone
00:38:46
one of us will now become his own
00:38:48
the refrigerator will perform these actions we
00:38:51
we get nothing more than normal
00:38:53
Sausage sandwich if we take it
00:38:56
real ingredients and let's go to
00:38:59
real refrigerator that is us
00:39:01
we'll get a sandwich with sausage
00:39:03
Likewise we can get a sandwich
00:39:06
with cheese only we will have others
00:39:08
caviar sandwich ingredients please
00:39:11
red black Yes Who has Which one
00:39:14
I have it lying around in the fridge please
00:39:15
let's get up Here we already
00:39:18
there is no need to cut anything off, let's say
00:39:21
Crimea is no longer cut out, we are not cut off
00:39:23
yes yes but we can do it as a separate action
00:39:27
create there take a spoon and put well
00:39:31
let's measure out a spoonful of caviar, that is
00:39:35
but accordingly, with different
00:39:37
ingredients with some like this
00:39:39
with small actions we get
00:39:41
real sandwich with caviar
00:39:44
here's a sandwich with jam, let's go too
00:39:47
opening grandma's favorite jam and how
00:39:50
would you like it with butter please?
00:39:52
bread Yes, we just want it with jam in
00:39:55
in general, who is salivating for something like this
00:39:58
that is, here is the difference between the methods
00:40:01
which return something and which
00:40:03
nothing is returned in this case
00:40:06
we take specific ingredients for something
00:40:09
we create this and return the result
00:40:13
what we did that is what we get
00:40:16
specific sandwich and we return it
00:40:19
result as concrete
00:40:22
sandwich you can eat That's what
00:40:26
different methods that do nothing
00:40:30
they return with the word inside
00:40:33
howl let's say read the recipe
00:40:38
took and read the sandwich recipe
00:40:41
would get a specific sandwich After
00:40:43
reads No did not receive any
00:40:46
the ingredients were not taken to the refrigerator
00:40:49
got up We didn’t cut anything there
00:40:51
No knife at each other
00:40:54
added up that is, we just read
00:40:56
recipe That is, but nothing
00:40:58
happened on the one hand
00:41:00
read-before-receive action occurred
00:41:04
on the other hand, we have no new information
00:41:07
got no result that is
00:41:10
read read sandwich from this
00:41:12
did not appear Or let's say the howl method
00:41:15
look at the picture of the sandwich too
00:41:19
Well, we looked at this picture.
00:41:22
some action also happened
00:41:23
watch our brain at the same time
00:41:26
some information, that is, something there
00:41:29
something has changed inside us somewhere, but
00:41:32
but we don’t have a real sandwich
00:41:36
it happened, that is, there was no action on
00:41:38
production of some real
00:41:40
sandwich and we don’t return it then
00:41:43
there is no anything to return That's either there
00:41:47
print the sandwich recipe is similar
00:41:50
our sisa is not enough Print that is from that
00:41:53
that we are printing some kind of recipe or
00:41:56
we print what should be the result of this
00:42:00
we'll get the recipe when it's here
00:42:03
we don’t have the sandwich itself
00:42:05
appears out of nowhere that is when
00:42:08
we use System Of inside no then
00:42:12
we don't return anything, that is, we don't
00:42:15
we return some kind of pouring with which
00:42:18
you can take it and continue to work with it here
00:42:21
I'll pour this sandwich that we take and
00:42:24
then we work with it, sit down and eat it
00:42:26
so we get some kind of Well, I don’t know anymore
00:42:30
the next product won't be so much
00:42:33
how to clarify Which Well, that is, we
00:42:36
took one product that we received in
00:42:39
the result of one method was made
00:42:42
there is something else with him and accordingly
00:42:45
got some more product further here
00:42:49
that is, in this case we are something
00:42:51
we return and when we just print
00:42:54
sandwich recipe as we wrote before
00:42:57
methods and everything we printed as if there was nothing
00:43:00
at the same time we don’t get Well, there’s something there
00:43:03
they counted it, they just took it, they printed it out, but
00:43:06
this something has gone nowhere, that is, she told us
00:43:09
nothing produced anything here
00:43:13
naturally all methods that do something
00:43:16
print the result of the work these are methods
00:43:18
Void here and here are the methods that return
00:43:25
which we can then take there too
00:43:27
some other method, for example a method
00:43:30
we can eat a sandwich there
00:43:32
pass there to this method eat
00:43:34
our sandwich there is a specific sandwich with
00:43:37
sausage as a parameter or there
00:43:39
two sandwiches one with sausage one
00:43:42
cheese as two parameters Here we go
00:43:45
accordingly we were these then
00:43:49
we can reuse for some
00:43:51
other actions so this is the method
00:43:54
which make a sandwich he returns
00:43:57
specific sandwich or method there
00:44:00
make with other ingredients
00:44:02
he will also return the sandwich
00:44:05
concrete sandwich And here are the methods
00:44:09
which seemed to have done the result went to
00:44:12
It’s as if nothing comes of it
00:44:16
there was no pouring out to use we
00:44:19
this or you then we can’t do it anywhere
00:44:21
such methods use the word Void and how
00:44:26
would that mean they don't refund
00:44:28
no value again wrong
00:44:31
talk a lot later in the future
00:44:33
they will say that I myself sometimes
00:44:35
I'm getting lost, it's howling, it's nothing
00:44:38
returns no Java works like this
00:44:41
that howl is the same thing he returns
00:44:45
some kind of altered state that is
00:44:48
our state before we read
00:44:51
sandwich recipe and after we
00:44:55
read the recipe it's not the same but
00:44:59
our lives are no longer the same, we are gone
00:45:02
at their point there they jumped onto
00:45:04
some new stage of development, that is
00:45:07
the state that was before is different
00:45:10
state Something that was the meaning of that
00:45:13
is inside this method anyway
00:45:15
something happened but in This means that
00:45:19
we do not return any money, that is
00:45:22
that there is no pour out which we then
00:45:24
we can pass it on and on with him
00:45:27
somehow work, that is, in this
00:45:29
the difference is that methods that are something
00:45:32
return some kind of pour we can from
00:45:35
take them away, I'll pour a new one and with it
00:45:39
work further and methods that do not
00:45:42
they return nothing or that is, we write
00:45:44
they still change the word
00:45:48
state something they return
00:45:50
altered state but at the same time they are not
00:45:53
they return no money and we can't
00:45:55
methods with the word will be reused
00:45:59
there let's say the next action is taken from
00:46:01
them it was to use the following
00:46:04
actions These are the examples so far from
00:46:07
life Yes, but what we need to remember
00:46:10
in relation to the code, this is what is in the underwear
00:46:14
returning method that is a method that
00:46:17
returns to some extent I'll pour it out here
00:46:20
just like that Well, here it is from the JAVA documentation
00:46:23
yes, that is, it’s just some kind of method
00:46:26
which returns some kind of pour out
00:46:28
there it is called Welly returning
00:46:30
Non value Return method That is, it's all
00:46:35
it returns something, it's just not
00:46:38
I’ll pour it out. That is, it’s not some kind of you or
00:46:40
which can then be reused
00:46:42
I don’t know the meaning of the state
00:46:46
which can be used there some
00:46:49
a set of some values That is, but
00:46:54
a method is a method that does not return
00:46:59
this is what you need to remember like, well
00:47:02
as if in relation to the future
00:47:04
these are important concepts for interviews
00:47:07
So yes, they speak Russian very often
00:47:11
that they are not there does not return anything
00:47:13
we write Void but this is not true, that is
00:47:15
after all, this is Non belurittering That is
00:47:18
it returns something, you need to remember
00:47:21
because in English there is no such thing
00:47:23
they say it always returns nothing
00:47:25
they say it's non-bye
00:47:28
here you go, and accordingly, here you go again
00:47:32
for comparison, that is, the method This is new
00:47:35
or Cherning method That is, it returns
00:47:38
changed state but it doesn't return
00:47:40
dust and the method that returns
00:47:43
I'll pour this sandwich or not And that's it
00:47:47
returns the sandwich and in Java in the code we
00:47:50
so we’ll write something like Return
00:47:53
I'll pour it out which we can later
00:47:55
use for other methods or there
00:47:58
for other actions or where we
00:48:00
we can also print, but already
00:48:03
I’ll pour it as a separate one and not just like this
00:48:06
here we print we print and it’s gone
00:48:10
to nowhere In the end because the method is nothing
00:48:13
didn’t return it So that’s how it will all be
00:48:17
in practice it is written in code that is, we
00:48:20
we already know the public Static will be we wrote
00:48:22
Well, Static is not a necessary word.
00:48:26
that is, in our case, the words Static
00:48:29
it is very necessary that we can use this method
00:48:32
call in the Main method in the same
00:48:34
class but in the future we have the word Static
00:48:37
will not always be needed more often not necessary then
00:48:41
there are only in certain cases we
00:48:43
we'll make a method by the way, so here's the method
00:48:46
maybe just a public thing but also a method
00:48:49
maybe it’s not even public, it’s just a howl
00:48:52
Then simply instead of the word public there will be
00:48:56
default value about this is needed
00:48:59
speak Well, that is, we can write
00:49:01
just the Void method without any public
00:49:03
By the way, Well, in this case, While We
00:49:07
worked with public methods by the way for us
00:49:09
it was necessary already starting I hope
00:49:12
that today we will get to the Big Topic Well
00:49:15
that is, it’s like it’s not like that with us
00:49:17
we must definitely pass
00:49:19
So it is advisable to familiarize yourself with
00:49:24
this topic and we'll see how it goes
00:49:27
Well, as the lesson progresses, so we can
00:49:31
this new theme is easy to use
00:49:33
public will be methods without a word by the way
00:49:36
because we will have different conditions
00:49:39
but according to how they are written
00:49:42
methods, that is, we do some kind of
00:49:45
we use the word that is, particular XS
00:49:49
this is how access to if we write Public
00:49:53
then this means that this method or
00:49:55
variable we can have public what
00:49:58
this is a variable they will be visible on
00:50:01
throughout the project from any
00:50:03
class from anywhere, that is, they will
00:50:07
visible because they are not visible to the public
00:50:09
open access we will talk about this later
00:50:12
we'll talk in more detail for now
00:50:14
just need to remember the word public
00:50:16
further This is Treten Tai That is, he
00:50:21
exactly Return Type if it’s a novella
00:50:24
returning we always write the word howl if
00:50:28
the method will return something then we
00:50:31
we will write the data type that this
00:50:34
the method returns in this example
00:50:37
us method returns data type
00:50:39
it can return any type, that's it
00:50:43
data types that we know method can
00:50:46
return if we need this
00:50:49
the method returned some data type
00:50:52
please we write that this is the method
00:50:55
which will return this data type
00:50:58
now for the best we'll see further
00:51:01
Each method must have
00:51:04
name and must be returing
00:51:07
Type in this case it can be non-value
00:51:10
lapped or value Return Type But here
00:51:14
these are two required parameters for
00:51:17
method, that is, the method can be either
00:51:19
Voight and some name or some
00:51:23
data type and name but without these
00:51:26
we cannot write two parameters in
00:51:29
method here, and accordingly we can
00:51:33
brackets or pass some
00:51:35
parameters one several Here either
00:51:39
do not pass any parameters either
00:51:41
We already have such methods
00:51:45
without parameters but but the main thing is that
00:51:49
we must indicate these brackets, that is
00:51:52
required things to create a method
00:51:54
this is to write little rivers this is to write this
00:51:59
name of the method and put round
00:52:01
parentheses Well, let it be Yes, well, plus as
00:52:05
we always say that there is a method
00:52:07
there is a badi body which is curly
00:52:10
we write in brackets that is, inside
00:52:13
of this body we write some code that
00:52:15
this method will execute that is
00:52:19
in principle an example of a method here is also an example
00:52:22
a method that does not have the word public or
00:52:25
there is another word, that is, there will be access
00:52:29
determined by default we're talking about it
00:52:32
we'll talk later but at the same time
00:52:34
The return type must be specified in
00:52:37
in this case the method name is Total there
00:52:41
is calculated there is a parameter and Number well
00:52:46
and accordingly some
00:52:48
value this value is returned and so on
00:52:51
what is the meaning of this
00:52:54
this is actually the data type But
00:52:57
here we write we are returning it
00:53:00
the value in the method in practice it will be
00:53:03
it's more clear just showing you
00:53:08
on the previous slide please Yes
00:53:12
in the lower right corner of this squares
00:53:16
it appears that this is one of the methods
00:53:23
may be a parameter
00:53:31
this is the return type this is not a parameter this
00:53:35
returned as we are here here
00:53:38
they said that we have methods that
00:53:40
return to Ilya and methods that are not
00:53:44
they return like this if the method returns
00:53:47
value We definitely have to be here
00:53:51
indicate what data type this method is
00:53:56
Yes, this is not a parameter, this is a data type
00:54:00
which method will return javi is
00:54:03
a little bit like I would say not at
00:54:07
that place is written in other languages
00:54:10
written to me in a little different place
00:54:13
for example, it’s easier to perceive differently
00:54:15
But this is Java. This is how we will learn
00:54:18
understand but now in practice it will be
00:54:21
more clear That is, while I'm talking
00:54:23
in words, perhaps many things are incomprehensible
00:54:26
The main thing is to understand that the parameter is what
00:54:28
written in parentheses next to the method And this is
00:54:32
These are not parameters This is the return type
00:54:38
and then further in parentheses
00:54:41
we can there and Navy and recruitment
00:54:46
to whom we transfer
00:54:48
internal with which in the method we will
00:54:51
work, that is, this is exactly the parameter
00:54:54
Naturally, yes, the parameter is different here
00:54:57
type and we pass it inside the method but
00:55:01
At the same time, this is what we think In the end
00:55:04
Yes, we took some parameter in
00:55:06
this particular method just to it
00:55:08
10 added and put in some
00:55:11
I'll add a variable and this is the variable we have
00:55:14
has a data type and we want to return that
00:55:17
what happened as a result of calculations and
00:55:20
because what happened as a result
00:55:23
calculation has a data type and we have it
00:55:27
we return this data type to the method
00:55:30
we write here before the name of the method
00:55:33
but now in practice it will be more
00:55:35
It's clearer than when I'm like a fairy tale
00:55:40
It’s completely unclear yes What’s here
00:55:43
it's happening now we'll just see it
00:55:46
I show you presentations so that you
00:55:48
they definitely opened it and looked at it
00:55:50
these are definitely the words we will
00:55:53
write for us now the word public we
00:55:56
we will use mandatory everywhere
00:55:58
the word further here in the green square we
00:56:03
return data type and everyone has one
00:56:06
method may be your own and also if we
00:56:10
We do not accept parameters at all as input
00:56:12
it is certain that in the end we will
00:56:14
return them that is, this is the data type
00:56:17
parameters does not depend at all on
00:56:20
the type of data that we return
00:56:22
because always Here we write
00:56:25
depending on what we write after
00:56:28
the words Return and the methods that return
00:56:31
must have the word Return
00:56:34
in our body, too, in practice, we are all of this
00:56:39
we'll see better, but how about you
00:56:42
when we were looking for tips on how to
00:56:45
methods are compiled, do not forget about
00:56:47
went to the presentation and saw what
00:56:50
each method must have
00:56:52
Return Type method name next
00:56:56
public we will be like a beginner
00:56:58
it is always necessary to register
00:57:01
understand that this word exists Even
00:57:03
if we don't write it it's still there
00:57:05
some word exists, we just use it
00:57:08
we don’t see the parameter sheet further
00:57:12
we can pass parameters, that is, to
00:57:15
round brackets and accordingly
00:57:18
By the way, Hindu style of writing code
00:57:20
when these curly braces
00:57:22
they write as if not the way we write here
00:57:26
here and they write here here but we don’t
00:57:30
we teach this style just here are the pictures in
00:57:34
Yes, you come across such people on the Internet because
00:57:36
mostly materials and Indians everywhere
00:57:40
Well, what if you see something like this? No
00:57:43
be scared, yes this is so Indian
00:57:46
style writing of the year so yeah And here it is
00:57:50
here we have just these curly
00:57:52
in parentheses the body of the Body of META method and
00:57:56
accordingly, here we write our code and
00:57:59
We must write the word Return if ours
00:58:02
the method returns something, some kind of pour and
00:58:05
this is the type of guy we are
00:58:08
return or type ex which we
00:58:11
we return dependencies on actions
00:58:13
should be written here further
00:58:16
what I wanted to say is that today you still have
00:58:19
there will be an additional topic for
00:58:22
studying is class
00:58:25
now we will go to the documentation about
00:58:27
let's look at this Plast literally
00:58:30
I don’t know, let’s look superficially but
00:58:33
at home you will definitely need this
00:58:37
link open documentation for the class
00:58:40
learn the techniques the way you did it with
00:58:44
other reference classes, that is
00:58:46
where you have a capital letter
00:58:49
in the same way you will need to Study
00:58:52
plastic and you will have several
00:58:56
well, these are links to Oracle documentation
00:59:00
but you will have several videos for
00:59:04
class to study the class these videos are for you
00:59:08
will help to study, as it were, methods
00:59:10
class and there will be two short videos on
00:59:14
five minutes for those who Well, in general
00:59:15
there is no time and in general it’s not like that
00:59:18
Everyone already knows Here are 4 more detailed ones
00:59:21
video, that is, in my opinion I’m already there for sure
00:59:25
I don’t remember. According to me there is part of the video on
00:59:28
English part is in Russian but still
00:59:30
I highly recommend it even if the video
00:59:32
completely in English you are nothing at all
00:59:34
don't understand anyway look because
00:59:37
that a cat is a cat Yes, he is a cat in Africa
00:59:40
That is, you will still see here
00:59:43
the man who shows it all
00:59:46
Shows some method some Method
00:59:49
how it works in this class Well, that's a plus
00:59:52
documentation plus a lot of experiments
00:59:55
home with your code That is what you have
00:59:59
there will be a lot of homework to use
01:00:01
class methods because we have it
01:00:03
This is a topic for self-study
01:00:06
that is, there is nothing complicated there, just
01:00:08
I would like to work with you more
01:00:10
the documentation was again collected together
01:00:13
this is kind of the concept that we have
01:00:16
there is a built-in Java class and
01:00:20
this class has methods and these methods
01:00:23
may be static, that is, we them
01:00:25
call from the class itself Let's go
01:00:28
Let's look at the documentation, that is, well, yes
01:00:31
traditionally the last part will contain the code
01:00:34
term on the last slide so far here as
01:00:37
if there was no link that's all from the presentation
01:00:40
as you saw, our topic seems to be very
01:00:42
little one let's go to the documentation
01:00:45
let's see where the class We are in the package hierarchy
01:00:51
putting together everything we've learned
01:00:53
Previously, the code of the Java language is very similar to
01:00:58
the cat that we ourselves write that he is
01:01:01
is divided into some packages in particular
01:01:04
Right now we're mostly working with the package
01:01:07
Java lang which contains the main
01:01:10
Java language built-in classes and what we
01:01:14
getting like ours this Jay is wild
01:01:17
which we then use
01:01:19
we can call Java language classes and
01:01:26
use them as if we ourselves
01:01:28
they wrote that they are available to us from anywhere
01:01:31
our custom code, that is
01:01:34
we create some of our own classes
01:01:36
packages but at the same time what already comes with
01:01:40
Java language is available to us everywhere we can
01:01:43
use and here we are for example
01:01:45
studied some reference type
01:01:51
we haven't studied much yet, but we already know
01:01:54
that such data types exist and they
01:01:57
nothing more than just classes
01:02:00
built into the Java language if they are with
01:02:03
big capital letter is written remember
01:02:06
that the reference data type is stored
01:02:08
differently and so that we create by creating
01:02:11
we create a reference type variable
01:02:14
object of this reference class
01:02:18
like and here you go, exactly the same
01:02:20
there is a MS class in the javal language
01:02:29
here it is also inherited directly from
01:02:33
class which is the most important for us
01:02:35
Class, if we see in the hierarchy then
01:02:39
there is one main class in the package
01:02:42
tailbone you inherit everything from it
01:02:46
the rest are these classes and what do they do
01:02:48
can be inherited directly like
01:02:50
for example, cool, it comes directly from
01:02:54
object of research, that is, he
01:02:57
a direct child of the general class, but they can
01:03:00
be inherited through other classes like
01:03:03
for example these data types
01:03:04
are inherited through the Number class and that is
01:03:08
the Number class also has some of its own
01:03:11
methods and accordingly they fall
01:03:13
directly as if available directly here
01:03:16
this class because they are inherited
01:03:19
from this class let's say the class cannot
01:03:22
see the methods of the Number class because
01:03:25
they are full siblings brother sister
01:03:28
but they do not inherit from each other but
01:03:32
they can both see what is written in
01:03:35
class both can use so yes
01:03:39
there are such pains deep hierarchies
01:03:42
inheritance is how we see here and there
01:03:46
as if everything very much depends on
01:03:48
why do they belong that is, what do they
01:03:54
inheritance wealth inheritance They
01:03:57
get that but back to class
01:04:01
mes That is, it is directly inherited from
01:04:04
forehead class That is, he is straight
01:04:06
child Here and accordingly here
01:04:10
You can read the description of this class then
01:04:12
there is basically its purpose
01:04:18
mathematical calculations and we see that
01:04:21
here are the fields of this class, let’s remember that
01:04:25
Previously we saw class fields that
01:04:27
calculated the minimum
01:04:30
value the maximum value of this
01:04:32
data type but for the MS Fields class it is
01:04:36
such a number and a mathematical constant and
01:04:40
the number of a couple is also in Russian We
01:04:44
used to it Yes, but in English the number is here
01:04:47
this is three dot 14 and this is 2.9 That is
01:04:53
these are two mathematical ones
01:04:55
constants you can read about them
01:04:58
somewhere on Wikipedia again
01:05:00
remember your school knowledge, that is
01:05:03
refresh what they ultimately mean so
01:05:06
these are the MS class fields these are these two
01:05:08
constants, that is, from the MS class we always
01:05:12
we can call the most accurate
01:05:15
value programming framework
01:05:18
constants constants and then
01:05:23
MS class almost all methods now
01:05:28
I check everything or not everything just in case
01:05:32
yes It turns out that absolutely everything
01:05:36
absolutely all methods As you can see They
01:05:40
static, that is, this means that everything
01:05:43
methods of this class are called from the very
01:05:45
class, that is, to call the method not
01:05:48
you need to create a class object like ours
01:05:51
let's say in a class for example
01:05:56
we had some methods static
01:05:59
we remember Yes, for example, static A
01:06:02
This method, for example, is not static
01:06:05
it had to be called from an object
01:06:08
class to create an object we wrote
01:06:10
integer capitalized and equal to New
01:06:16
integer capitalized in brackets
01:06:18
I’ll pour some kind of Yes, let’s say they passed it on
01:06:21
there is to call these methods
01:06:23
who didn't have a word by the way at the beginning
01:06:26
we needed to create a class object
01:06:29
so that we can call the let's method
01:06:33
But some methods we could simply
01:06:36
write the name of the class integer put
01:06:39
point and we have already seen these methods here
01:06:43
accordingly let's say
01:06:48
remember We used him for homework he
01:06:51
we were called from the integer class because
01:06:54
that he belongs to the class therefore
01:06:57
we called the class itself the integer class and we
01:07:01
may have already seen this method But so
01:07:03
use the comperte method for us first
01:07:06
I had to create some kind of variable
01:07:09
type integer and remember that
01:07:12
variable of type intege with a capital letter
01:07:14
It is always an object, that is, through a word
01:07:16
New even if we don't have to
01:07:18
it doesn't matter if you write a word somewhere
01:07:21
there on the subcortex of our move it is
01:07:23
the object is registered and created. So
01:07:26
then we had to call
01:07:28
let's allow this variable and put
01:07:31
point and then we could see this one
01:07:34
let's allow a method because it doesn't have
01:07:38
words Static in front That is, he is not
01:07:41
static does not belong to a class and
01:07:44
accordingly, we seemed to have seen this
01:07:47
method only calling the object
01:07:50
mine could have been called and also Pay
01:07:54
Please note that these are the ones you look at
01:07:56
here are the icons and well, or rather the int byte types are there
01:08:00
I don’t know double Bulin these are just the types
01:08:05
data that these methods return
01:08:09
that is, we have these methods
01:08:12
I'll pour out the return ones, but maybe we
01:08:16
we'll be lucky and we'll see some method
01:08:19
which returns will be that is
01:08:21
does not return any pouring no to us
01:08:24
lucky here we see only data types
01:08:26
we also see that the method is allowed
01:08:29
can return primitive data type
01:08:32
some method but at the same time different
01:08:35
the method returns an integer but with a large one
01:08:38
letters that is the reference data type That
01:08:41
there are all types of data that we studied
01:08:43
earlier we can write methods that
01:08:46
return there all data types that
01:08:49
we already know but so back to
01:08:52
class in class just so much
01:08:56
static methods That is, all these methods
01:08:59
we can only call from the MS class
01:09:01
But we don’t need to create an object either
01:09:05
for this class to call the method but
01:09:09
we see that each of the methods is also
01:09:12
Almost everyone doesn't know for sure right now
01:09:15
Let's look through the list But that's all that's on
01:09:19
on this page each of the methods
01:09:20
returns some kind of pour which then
01:09:24
we can take it from this method and somewhere
01:09:27
there to be reused here today we are
01:09:30
let's practice a little with the class in
01:09:32
mostly this will be your homework
01:09:34
study class methods Yes and I see no
01:09:38
Do we have some method here that
01:09:40
returns the fight Well, that is, I won’t pour it out, but
01:09:43
just an altered state, too, no
01:09:46
We're lucky, I don't see a method that
01:09:49
there were just some types of data everywhere
01:09:55
for example, crowbar That is and But today we
01:10:00
We will write with you the following methods in principle
01:10:03
Voight You and I have already learned to write that
01:10:06
there is, well, when we print something but
01:10:09
no spillage is formed
01:10:11
Right now, without going far
01:10:14
let's move on yeah
01:10:24
on this site, basically you should already
01:10:28
be able to find It's me just like that
01:10:31
hint now off Let's
01:10:36
not to include chat but in principle
01:10:40
Watch the previous lessons because
01:10:43
we've already gone through this all the right way
01:10:46
looking for everything is an important skill to find
01:10:52
I'm trying to find a link to a presentation
01:10:55
she is present at one of the presentations
01:10:59
is already in the presentation of which we already
01:11:24
really needed for today
01:11:26
now during the lesson she says this to you
01:11:28
I don’t really need it, but I encourage everyone
01:11:30
work with presentations and search
01:11:33
documentation yourself because
01:11:35
you really, really need this at work
01:11:37
it will be that means And now we are going I will
01:11:47
you can ask too, yes, but tell me for
01:11:51
the homework we just did A
01:11:53
it was also possible there then
01:11:54
use in some cases which
01:11:58
there is a clock I want to do and now I’m already
01:12:02
said without moving far from the cash register
01:12:04
let's take this fresh method
01:12:07
which we just wrote and how
01:12:10
you already saw the method itself in homework
01:12:12
there is nothing complicated, we wrote it like this
01:12:15
so that we are printed with the value Yes but with
01:12:20
this we had a howl and that is, no
01:12:25
That is, how to understand that this is the method of combat and
01:12:28
that we can’t reuse later
01:12:31
what we formed here inside
01:12:34
some line Yes, that is, we
01:12:37
essentially formed some kind of string from
01:12:39
some values and we straight this line
01:12:43
we printed the method itself like this
01:12:45
look if I call in the Main method
01:12:54
and here I will pass this our method
01:13:00
and pass some parameters
01:13:06
I still need it there
01:13:15
and forgot to eat and pass on
01:13:20
I do you see I have problems I can’t
01:13:26
the result of this method
01:13:29
that is, this method does nothing
01:13:33
returns Java prompts me immediately
01:13:35
compiler, well, it’s not here at all
01:13:39
knows what's going on and is trying to help me
01:13:41
just force the arguments into a separate one
01:13:43
fold the line but in reality this is a mistake
01:13:46
happens because Method with Kayla
01:13:49
action it doesn’t return anything for me
01:13:53
there is, it does not return or rather exactly that
01:13:56
I have this method, so I
01:13:58
I can’t put it in another method
01:14:01
use the result that he had
01:14:04
let's say produced
01:14:05
here in another method the microphone is on
01:14:09
If you want to ask a question, ask
01:14:12
if not, it turns off. Now we’ll write
01:14:15
Exactly the same method, I'm just watching it
01:14:18
I take it and copy everything absolutely the same
01:14:28
he will be absolutely the same only
01:14:30
look I won't print the result
01:14:35
I'll take it and create some here
01:14:44
That is, well, let’s call it
01:14:47
cut That is, this is what I want in the end
01:14:50
get some string that
01:14:53
brings together my text and my
01:14:56
parameters values I put a dot here
01:14:59
comma and look now I'll write what I
01:15:05
I want to return this one using my own method
01:15:12
accordingly, I have it underlined here
01:15:15
in red because it says here that
01:15:17
the howl doesn’t come back, no howling A
01:15:20
here I wrote down what I want to return
01:15:22
this is the result in the form of a string like
01:15:25
the result of this method: Here it is
01:15:28
accordingly, since I have the result
01:15:32
has a data type then I just take it and here it is
01:15:35
here instead of the word exhibition please
01:15:39
this method is starting to bring me back
01:15:42
I will display the data type Stream That is
01:15:50
I can use it later and
01:15:54
look what else I wanted to do now
01:15:57
yes, that is, in my title it’s
01:16:00
when nothing comes back just
01:16:02
it's being printed and here I am
01:16:07
Action files Let me remove one
01:16:11
because that's the same name
01:16:12
because this is the method I use
01:16:14
will return some result
01:16:17
some of these klmagends that will
01:16:20
there to gather in one line and this one
01:16:24
the method will return this string and
01:16:26
Now look how one is no different
01:16:29
method from another can because this
01:16:33
the method will be And I can’t print it
01:16:35
the result is because it is inside me
01:16:38
as if nothing comes back But
01:16:40
now I write myself and call another
01:16:44
the method I have
01:16:48
and here I pass the same parameters
01:16:54
previous line and look I launch
01:17:00
and I'm getting the same thing now
01:17:03
wait a second, this is me for cognition
01:17:07
so that it doesn't bother us because it's
01:17:10
We printed it using a different method. So
01:17:14
look I get the same one
01:17:16
a line with parameters Key L like me and
01:17:20
conveyed Yes, only now this line is
01:17:24
I am not printed inside the method, it is
01:17:27
me is formed inside the method and she has
01:17:30
me comes back and Dante's type
01:17:34
meanings I put here and now I
01:17:38
I can use this method there in any
01:17:41
Well, that is, I now have this method
01:17:44
automatically equal to some string here
01:17:47
see what this means
01:17:49
that I'll take some kind of Stream
01:17:56
let's say there is a variable there
01:18:01
and I can assign the result of the work to her
01:18:09
which returns something That is, I take
01:18:12
method I pass parameters to it
01:18:20
and here is the result of this method:
01:18:24
I can add a variable
01:18:27
you see because this method returns
01:18:30
data type Stream and this and how
01:18:34
the result of the fact that this method is inside
01:18:37
does himself so as to have this result
01:18:40
this spin I can just add
01:18:42
variable Stream or I can here
01:18:45
print using System Of because
01:18:48
that I have some kind of you as a result
01:18:51
this method works and I pass it on
01:18:55
I have some kind of you like Stream and me
01:19:00
I can add it up to a variable theme, that is
01:19:03
my method in this case is some kind
01:19:05
already as it were
01:19:07
that is, some text exactly like Stream
01:19:11
because it returns data type
01:19:15
also If you are allowed
01:19:21
Let's create some method
01:19:28
let's say we have some kind of
01:19:31
return value and let's say
01:19:34
let's call it double
01:19:40
That is, he will accept
01:19:49
because he will receive from me
01:19:54
let's say we remember some specific parameter
01:19:59
that the name of the parameter in the method does not matter
01:20:01
what matters is what type of data. That is, it will be
01:20:03
take some number and
01:20:06
here let's say I write what their prize is
01:20:12
who will take this number and
01:20:15
multiply it by 2 That is, it will be like
01:20:18
would be a double in which he took that is
01:20:22
double the value Here I have
01:20:27
here it is underlined in red Because
01:20:30
if I write here that the method should
01:20:32
return before the method name if I
01:20:35
I write that it should return a data type
01:20:38
then it is not necessary to register
01:20:41
the words Return and write what this method is
01:20:44
will return she will return me
01:20:46
will be This Rizal Rezal has the type
01:20:53
matches Yes and accordingly, if I
01:20:58
now I’ll take my new method and write
01:21:02
sout yes, that is, inside this method I
01:21:06
I don’t print anything anywhere, but this method is
01:21:09
it brings back some intrigue to me
01:21:13
here let's say I'll just pass the number
01:21:18
So this is the method
01:21:22
takes this number and according to the data inside itself
01:21:26
he will double this number That is, I expect
01:21:28
get 12 and this is 12 this method does not
01:21:33
the system will return another method
01:21:37
will take the number 12 and print it out
01:21:46
Yes please print 12 exactly the same
01:21:50
I can take some kind of variable
01:21:54
let it be and put the result in it
01:21:59
my method works from the number 6
01:22:05
So, accordingly, if I now
01:22:08
I'll print out the variable
01:22:17
12 Yes, because I have this method as
01:22:22
would calculate something within himself
01:22:26
the output from this method will be 12 this is 12
01:22:30
will be assigned to variable B and when I will
01:22:33
print variable runout
01:22:38
That is, the variable itself is, as it were,
01:22:41
she didn't do anything, she just took it
01:22:43
the result of the method which
01:22:46
returns to them We see that Yes I received
01:22:49
12 twice this is my variable And this is y
01:22:54
me when I was typing myself and him
01:22:59
Are there any questions regarding this part?
01:23:04
if we have two methods one is cleaned
01:23:08
some meaning other other we them
01:23:11
we can add each other
01:23:13
it's just through
01:23:16
we need to add the variables Or we can do it directly
01:23:18
write let's do it
01:23:39
So let's call it three half-values
01:23:47
we’ll also have some kind of variable there
01:23:50
get it here we will triple it
01:23:53
click on 3 and return the result too
01:23:57
only this will return in some number
01:24:00
it will already be
01:24:02
that is, multiplied by 3 Let's check
01:24:06
that this method works
01:24:16
print out the result we are waiting for
01:24:18
Get 15 we got it because
01:24:22
by 3 inside the method Finally returns
01:24:25
result 15 which we can
01:24:27
print via command
01:24:31
but we can make some variable
01:24:38
variable itself And what can we do We
01:24:42
take the W method
01:24:45
from 6 we add trippy
01:24:50
That is, we see that we actually
01:24:53
adding up the results of our own work
01:24:55
methods and let us print it ourselves
01:25:10
and we get 27 because 12 before
01:25:14
halfvalue returns method 15 return
01:25:18
three sexual 12 plus 15 is 27 that is We
01:25:22
we produce ordinary mathematical
01:25:25
actions because due to the fact that these
01:25:28
methods returns some kind of pour them already
01:25:31
as if mentally you can just not even
01:25:34
consider methods Because if they
01:25:36
return something accordingly We
01:25:39
we work with these
01:25:41
just like if we returned here
01:25:44
some kind of Stream method, we’ll allow it
01:25:47
could have been there
01:25:50
with the result of the work, let's take
01:25:54
the same method just different
01:25:56
parameters and we want
01:25:59
we will no longer have arithmetic
01:26:03
addition is already
01:26:09
Well, let’s say here we make the parameter m
01:26:12
and we will see that is and now if I
01:26:16
I'll print out the text
01:26:22
I comment And here I will print it here
01:26:25
the very text that I take from
01:26:30
constancy of two calls to one and
01:26:33
the same method only with different
01:26:42
I print and look at the result, that is
01:26:45
here I have the result here when I
01:26:49
this system printed
01:26:52
call one method call with
01:26:55
Cale's parameters
01:26:58
And here we see me as if double
01:27:01
one line stuck to another
01:27:04
because this patination of two
01:27:08
results and this method is given to me
01:27:12
This is the result
01:27:16
Here we see absolutely the same And here
01:27:19
this method gives me this result
01:27:24
I sort of concentrated them together
01:27:28
is when we have two Street variables
01:27:31
then we just have 1 variable
01:27:33
stick another one
01:27:37
space to do this on purpose
01:27:41
so you can see that it's just me
01:27:43
the second part stuck to the first because
01:27:46
that the result is of the Stream type and in this
01:27:50
case plus is valid
01:27:56
yes Tell me if there is one method
01:27:59
Well, hypothetically some task
01:28:01
there is one method we did which
01:28:03
returns Stream and another method we have
01:28:06
returns, let's say, a number Well, it doesn't matter
01:28:08
we need to add them up we Well, it’s clear that
01:28:11
we need to create some kind of variable
01:28:17
but first, tell me if I will
01:28:29
and print some value that I
01:28:37
yes that is I will get it
01:28:40
Stankotenated texts with meanings That
01:28:43
there is I can't add Stream and value
01:28:46
that is, in this case Add it means
01:28:53
because if we are the first to allow
01:28:57
we print Street then according to this
01:28:59
mathematical operations will not continue
01:29:02
will be easy to produce
01:29:04
the first text will have a value added
01:29:09
just like we would do this
01:29:13
through the method but again accordingly
01:29:22
let's make one text
01:29:25
and let's add here what we get, let's say
01:29:30
as a result of this method working like this
01:29:33
how he returns Stream
01:29:35
and as a result of this method:
01:29:39
since he gives them back
01:29:43
we’ll get the text for it in exactly the same way
01:29:46
the sticky meaning is close that is
01:29:53
and I print this text alone
01:29:58
and correspondingly
01:30:04
I receive some text to him
01:30:10
just like here some text to
01:30:13
values attached to it number numbers
01:30:18
Well, that is, everything is the same as in
01:30:22
actions are the same as what you do
01:30:25
with regular texts and numbers you can
01:30:28
do with the results of the methods
01:30:32
Because if the methods return
01:30:35
some kind of data type then all the rest
01:30:38
rules for these methods apply
01:30:41
absolutely the same as for ordinary numbers
01:30:44
or text That is, everything is the same with
01:30:47
In this case, our methods can return something like
01:30:51
any type of data we wanted
01:30:58
any type of data we want
01:31:01
so that they return Here But with methods
01:31:04
accordingly you can do nothing about it
01:31:06
you can't because the method doesn't return
01:31:10
no pour out so everything that happens
01:31:12
inside the howl method it’s as if she’s not going anywhere
01:31:16
goes that is, if we are here
01:31:19
let's write that there will be some kind of variable
01:31:21
Stream also let's call her cut
01:31:27
let's write equal
01:31:29
and just like in another method we do this
01:31:35
let's put a comma, you see absolutely
01:31:38
the same as in this method but no
01:31:41
the words Return and if this method
01:31:45
nothing comes back here
01:31:47
returns meaning no meaning
01:31:50
comes back but that is this
01:31:53
variable cutter us anyway
01:31:55
only we will form it in such a way
01:32:02
Because if there's nothing here
01:32:05
returns as if this is all the action
01:32:07
but it goes in vain because it’s here
01:32:11
it’s not even printed, that is, here we are at all
01:32:14
nothing seems to happen but at the same time
01:32:16
the program did something
01:32:21
and let’s say if I’m this one now
01:32:25
method trying to print
01:32:32
because he doesn't have anything to me
01:32:40
That is, and look at me all at once
01:32:43
this is emphasized and I have nothing to do with it
01:32:46
I can’t do it Now there will be an error
01:32:49
here we have Voight and that he is not allowed
01:32:54
here inside the Print Land method
01:32:57
because the Land printer needs something
01:33:00
do get some text and
01:33:03
print it here but like this one
01:33:06
method does not return anything
01:33:09
the team doesn't know what to do
01:33:11
in the same way I can’t create
01:33:16
Stream variable is acceptable
01:33:22
was not there and assign the result of the work to her
01:33:30
with all the parameters I can't assign
01:33:34
Why Because here you go please
01:33:36
They say that Print is actually nothing for us
01:33:39
does not return Make it so that he
01:33:42
returned Stream and then you can
01:33:44
assign the result For now it is nothing
01:33:47
returns something here I don’t seem to have
01:33:49
I'll pour it out and I'm trying to appropriate it
01:33:52
variables of type Stream That is, if
01:33:55
here I could easily assign
01:33:58
because something was coming back
01:34:01
or just appropriated it now
01:34:04
let's just say variable text
01:34:06
appropriated it too
01:34:11
or maybe I was typing because
01:34:14
came back Stream then here I am nothing
01:34:18
I can’t do it with this method and
01:34:21
I must say that methods
01:34:23
minority because they are very rare
01:34:27
generally needed so that if there is something there
01:34:29
produced internally and considering that
01:34:32
programming testing we do nothing
01:34:34
we don’t print but very rarely seem to be needed
01:34:37
methods that have nothing inside themselves
01:34:39
They don’t produce it, but they change it
01:34:45
We'll talk later about what they're for
01:34:48
Testing is especially needed, but somehow
01:34:51
We ourselves will very rarely write
01:34:54
methods that do not return
01:34:56
we have basically all methods
01:34:59
will return for some time Therefore
01:35:02
Yes, today we have such a topic that
01:35:05
learn to use them
01:35:09
we can't do anything
01:35:16
variable that is returned to
01:35:19
second and when we connect them at
01:35:21
execution from one method is not
01:35:24
transferred to another Regardless
01:35:25
there are no conflicts that arise
01:35:28
specifically do you mean
01:35:33
Where do we describe
01:35:36
the method itself
01:35:41
everything that is written inside the method
01:35:45
exists only inside this method
01:35:48
method remember skok remember we
01:35:51
they said that this method is inside itself
01:35:54
does not see this variable in any way, just like
01:35:57
this method is inside itself this one
01:36:00
does not see the variable inside the method
01:36:03
we can name the variables whatever we want
01:36:06
repeat the name as many times as you like
01:36:08
the same but as if they were written
01:36:14
the variables we created are three
01:36:16
pump variables they are not visible at all
01:36:19
to another No, this is when they are completely different
01:36:23
method completely different year and they are each other
01:36:26
they don’t see a friend so no
01:36:29
doesn't happen here because it's two
01:36:32
independent from each other and they are in
01:36:35
There is such a concept in different brackets
01:36:44
these ospreys separate one code from
01:36:50
that is, these names they can be
01:36:52
whatever they want, but they don’t see each other
01:36:55
these two pieces of the move have nothing to do with each other
01:36:58
doesn't work but if we want
01:37:01
let's go to this method to create
01:37:10
This is a dead method for us that is not
01:37:13
returns no but Let's say
01:37:16
let's take and assign the result of the work here
01:37:23
and take some parameters that Well
01:37:27
we can't take it like, well, we can
01:37:29
work only with those parameters
01:37:31
who come to us exactly at this time
01:37:34
method I take then parameters 1 parameter
01:37:39
further than 3 there was one because the parameters
01:37:43
absolutely the same what's for this
01:37:45
method that for this type of parameters
01:37:47
exactly the same so I can
01:37:50
use the parameters of this method to
01:37:54
and if I do this, then this
01:37:58
variable cut get what will do
01:38:02
this is the method with this
01:38:07
but I think it's still a little difficult
01:38:10
for beginners' understanding, let's
01:38:13
let's dwell on what we are in general
01:38:15
let's learn how to write these methods because you
01:38:18
It’s like you’re running a little further, but then
01:38:21
what you need to understand exactly is what
01:38:23
inside one method Whatever variables
01:38:26
you didn't create so that you wouldn't be with them
01:38:31
this is what happens inside one
01:38:33
method the other method will not see But if you
01:38:36
inside one method you call another
01:38:39
the method is natural at the time of the call
01:38:42
this method works and will
01:38:45
if not, it returns something
01:38:48
accordingly you can use
01:38:50
inside another method now we
01:38:52
Let's try to do this on other tasks
01:38:55
because this is not a very good example
01:38:57
in order to work with this
01:38:59
here are some other questions about
01:39:03
return on the topic of return
01:39:07
or we’ll try to interfere with the problems
01:39:10
return Can I ask this question?
01:39:13
if we have a variable in a method in brackets
01:39:16
let's denote the type float And the method itself is type
01:39:18
int then it will just give us an integer
01:39:22
without this remainder
01:39:25
It depends on what code you have inside
01:39:28
you prescribe, we don’t just take from
01:39:31
[ __ ], some data types are acceptable if
01:39:35
we need to create some method
01:39:43
but let's say As you said this method
01:39:50
we will say that we will accept
01:39:52
variable of type Flow I also have the name
01:39:56
I came up with just writing down your task
01:39:59
According to you, the experimental task in general
01:40:02
all experiments are just yours, as it were
01:40:06
students' responsibility at home with everyone
01:40:09
experiment with these things but
01:40:11
Let's take a look now, that is
01:40:13
some variable like Flow will come and
01:40:16
what are we actually going to do with her?
01:40:18
do it and then return the result, what are you doing?
01:40:22
what is our scenario with this variable
01:40:25
Flow what we will do Let's say
01:40:27
how we were able to find speedvage that is
01:40:31
we take distances there. Okay then for us
01:40:35
need variable distance
01:40:40
it will just be here, that is, we are not
01:40:43
we write methods just like that, we have all the methods
01:40:46
are written for something so that they do something
01:40:55
that's what we're doing, we'll
01:41:09
This is what we need inside
01:41:12
we need to do some result then
01:41:16
there is if we are going to it exactly in
01:41:18
we write this same one to return
01:41:23
that is, here we will add what I
01:41:27
meant that if the variable fruit
01:41:29
That is, you do the actions completely
01:41:36
And by the way, guys, I also saw that
01:41:39
everyone used Flow, remember that
01:41:43
we were just learning what a variable is
01:41:46
exists we never seem to be in progress
01:41:50
problem solving because we do everything
01:41:56
what is Always exists But this type
01:42:00
the data is deceased, so we won’t even talk about it
01:42:03
nothing to do I saw Dan parsing
01:42:06
a lot of people use homework but
01:42:09
Remember I told you that we are just
01:42:12
studied and used exactly within the framework
01:42:15
one homework to find out
01:42:18
this is an extinct data he has absolutely no data for us
01:42:21
needed for calculations and what we will do
01:42:24
only in Double, so we forget the word and
01:42:28
Let's say two variables of type arrived
01:42:30
But Time is usually not in Double
01:42:34
denote Well, okay, let it come and
01:42:37
Let's say we take this distance of ours
01:42:45
we divide it into time which also
01:42:50
and so that we get all this result
01:42:52
it is considered that we need a result
01:42:56
calculations wrap
01:42:58
so that we have it in the end
01:43:02
this is how we wrap it is also called
01:43:05
that's right And here we are, we got it
01:43:08
some result of the division we have
01:43:12
will be calculated accordingly
01:43:23
That is, we are returning him. He is with us.
01:43:26
data type the method will return itself
01:43:30
this method will return the type
01:43:32
data and Let us assume this average
01:43:35
we want some other speed there
01:43:37
increase the average speed, that is
01:43:40
Let's call this method twice from different
01:43:42
values that is and accordingly
01:43:45
Let's say what we have
01:43:49
some kind of Total
01:43:51
I don't know why we need it, but it's just
01:43:54
already a task that does not have
01:43:57
relationship to real life
01:43:59
we will have and we call one
01:44:15
245 will read and let's say I have time
01:44:19
I don't know there
01:44:22
And now I therefore want to add
01:44:27
accordingly another result
01:44:31
and let's say I think it's 12 o'clock
01:44:59
275 is two hours three quarters to 2 and 3
01:45:03
quarter of an hour so I want to add it up
01:45:06
what this method returned it returns the type
01:45:10
data with the fact that I returned this method
01:45:13
I add it all up somehow
01:45:15
and accordingly I think I’ll print it out
01:45:24
that is, the main thing is that Yes, I have parameters
01:45:28
data types come Double but at the same time
01:45:31
the methods themselves return them and like this
01:45:34
I didn’t manage to check the total
01:45:37
I will Correct Wrong most likely
01:45:39
that's right, we just divide the disk by time
01:45:43
That's it, but accordingly the main thing is that I have
01:45:47
this method returns
01:45:50
that is, the value in the type accordingly
01:45:54
the sum of two points is mine
01:45:59
got some result data type
01:46:02
which we convey there is absolutely no way
01:46:05
does not depend on the type of data it is
01:46:08
the method may ultimately return But everyone
01:46:12
method we are not just there I don’t know from the sky
01:46:15
they took and wanted each some type
01:46:19
data create each method are created
01:46:21
for a specific task
01:46:24
accordingly Let's now move on to
01:46:26
parts where we will interfere with the task
01:46:28
in which we need, let's say, some types
01:46:31
data and we will return some kind
01:46:34
data type First we have easy problems
01:46:36
let's interfere, but no matter how each method
01:46:41
is created Just like that it is created for
01:46:43
performing a specific task and
01:46:46
accordingly depending on what
01:46:48
we have to do in this method and for
01:46:51
why is it being created in our country?
01:46:53
look at what parameters we need in
01:46:56
such and such data type and we return
01:46:58
we will already have such and such data for you
01:47:00
because this method should be valid
01:47:02
return a different data type
01:47:06
meanings But it all depends on what
01:47:08
What exactly do we need this method for?
01:47:11
There are still questions about this part
01:47:16
let's still get to the task
01:47:19
we're going somewhere else now
01:47:21
because it’s like we’re already starting in the wrong place
01:47:24
think about it, let's decide
01:47:26
some specific tasks Now I
01:47:28
just doing that's how I'll take it
01:47:36
such puzzles are stored up
01:47:39
since we started the lesson with this task
01:47:42
This is actually the code I'll give you here:
01:47:46
I'm writing here Let's
01:47:53
so I'm putting some here
01:47:59
I have 2 lessons, let's say 2
01:48:05
I don't have time to write your code after you
01:48:10
Sorry, yes, but still we have a task to
01:48:13
listen more in class than write
01:48:15
that's right And now we will have three of these
01:48:20
I think there are three or four problems here
01:48:24
which we need to solve today and
01:48:26
then it will seem like we will have time
01:48:29
go to parts 3 or not, well
01:48:31
accordingly, I’ll take it here too
01:48:39
real solutions to real problems
01:48:42
This means that first we will do yes
01:48:48
let's get straight to this problem
01:48:50
this is where you need to test it
01:48:52
there is what you need for your home
01:48:55
work in part 1 homework here you go
01:48:59
and accordingly We will take Let's say
01:49:01
such a problem Find the maximum
01:49:04
value between variables
01:49:10
and we start testing the work of ours with
01:49:14
very easy methods we don't go there
01:49:19
and Let's write some methods then
01:49:23
there we divide the task into task and
01:49:25
First we will find the maximum value
01:49:27
between some two variables and Well
01:49:31
let's say we have them
01:49:34
that is, we write
01:49:41
we will have him back
01:49:44
the maximum value of the two That is
01:49:48
if we have both values then in the method
01:49:55
while this and B then respectively
01:50:04
Here's the type accordingly
01:50:07
we will return something
01:50:12
because between two variables
01:50:17
the maximum will be one of them
01:50:19
accordingly, also a data type because
01:50:22
that we won’t actually do anything
01:50:24
Except that we will choose which one
01:50:26
more this or this and accordingly
01:50:29
Which one is bigger?
01:50:31
Well, let's say we call our method
01:50:35
starting with the verb
01:50:46
the maximum of the two because we have
01:50:49
there will then be a maximum of three
01:50:51
the maximum of 4 is for these sub-tasks
01:50:54
That is, we write this method
01:50:57
Well, let's help both of us
01:51:00
find more meanings what do we need for this
01:51:14
This is how we write them, that is, I don’t just tell you
01:51:17
so I ask you at the interview too
01:51:20
may also ask: Should you How?
01:51:22
would answer That's accordingly what's with it
01:51:28
yes, that is, we say what if and more
01:51:41
maximum value value
01:51:47
we can create some kind of intermediate
01:51:53
and then we will say that Max
01:51:59
Yes, otherwise, if you don’t stay with us
01:52:08
Otherwise we will say that Max is equal to Binet and
01:52:13
accordingly, so that he can do the same for us later
01:52:17
I need to return this
01:52:23
let's check our method
01:52:30
they won't necessarily be there then
01:52:37
Wait or if we have more than B
01:52:41
Do you mean that it may be
01:52:44
equal Okay, let's make this condition
01:52:46
that is in this case if Hey more
01:52:50
or equal to B then well, they are the same
01:52:54
we don't care which one we return
01:52:56
we will say that Max is equal to her yes And if y
01:53:01
there are no more of us than equipoise, that is
01:53:05
less then accordingly
01:53:08
we do that is, it is equal to good
01:53:12
remark because they can be
01:53:14
are equal but as if on the algorithm itself it is
01:53:17
it doesn’t influence us, that is, they set us up Well
01:53:21
so we got something like this
01:53:23
method that will find
01:53:25
the maximum value of the two and by
01:53:28
old habit for all beginners
01:53:30
it was more clear We'll just print it out
01:53:34
the meaning of this method That is, I I take
01:53:39
and we had a method there it was called So
01:53:44
here Let's pass any two numbers
01:53:54
Well, let’s print accordingly
01:53:58
meaning that is, we do not print inside
01:54:02
method we print when we are apart
01:54:08
and there we write our method inside
01:54:12
which returns some value
01:54:15
the maximum of the two, we see that the method
01:54:18
worked correctly And here you go
01:54:21
we printed the result here
01:54:25
now let's talk about this part to everyone
01:54:29
everything is clear why
01:54:37
33 Let's check 33 essentially what
01:54:41
we expect to receive
01:54:43
3 Yes, so we take our method
01:54:49
So, accordingly, we transfer 33 there
01:54:53
could create separate variables for them
01:54:56
assign some value but we are straight
01:54:58
these were here We transfer everything on principle
01:55:01
it’s as if they immediately conveyed that
01:55:03
create variables and Yes we get 3
01:55:06
the method works here
01:55:15
what is the maximum value between 3
01:55:18
Irina turns out to always be published
01:55:29
that is, we will take the value that
01:55:36
no here by the way if it was before 9 9 what at 3
01:55:42
will always only come out
01:55:44
they are equal, what is the difference in conditions then
01:55:49
they are equal to ours there is no condition to withdraw
01:56:00
Who cares which one we will be
01:56:14
We will check the purity of the experiment so that 95
01:56:17
Yes And you see we have equal 9
01:56:34
or there Regardless and more beat bi
01:56:37
more he still thinks more like
01:56:41
would print more but not
01:56:44
outputs the method does not output anything to
01:56:46
print it returns the larger value
01:56:48
we're printing mine. Now let's go with
01:56:53
we will write a method of the MS class exactly like this
01:57:00
I'll copy it to waste time but only
01:57:03
with number 1 we will have exactly the same
01:57:06
come 2 variables and trouble but here it is
01:57:13
look, we will call the Ness class and have it
01:57:17
there is a Max method
01:57:20
which will already be between the two
01:57:22
variables consider the maximum
01:57:25
this is the value it will return
01:57:27
the value of the type that is from it from
01:57:31
class places I call the Max method there I
01:57:35
I pass what comes to my method
01:57:39
it's called a rapper when I'm alone already
01:57:44
I wrap an existing method in another
01:57:46
your method, that is, essentially
01:57:49
this operation makes no sense because
01:57:52
that such a method already exists built in
01:57:55
language and how to wrap it in your own method
01:57:59
there is no point because why should I
01:58:03
as if to wrap one in two wrappers and
01:58:06
the same candy, that is, it’s just wrappers
01:58:12
environmentally friendly not clean let's say that is
01:58:16
accordingly I just took another one
01:58:19
wrapper and chair in another wrapper
01:58:23
existing that candy, that is, that code
01:58:26
which is in this Max method then
01:58:30
there is when I write my Max method
01:58:32
it's Okay because I'm doing my own
01:58:36
the algorithm may for some reason tell me
01:58:39
The algorithm of this method does not suit me
01:58:42
I just want to create a layer for which
01:58:44
there will be a slightly different algorithm OK I am
01:58:47
I do, but how would I take one method and
01:58:51
wrap it in another wrapper
01:58:54
let's use blue wrappers to make red ones
01:58:57
this is from the point of view
01:58:59
there is no point in programming
01:59:01
So yes we can do this to
01:59:04
just check that yes we do too
01:59:06
you can do it even though it is pointless and
01:59:09
let's say Now we do
01:59:13
and here We transfer our method but only
01:59:17
number one at the end which is from Max
01:59:20
will work and let's say exactly the same
01:59:26
print it out and expect we will receive 9 and we
01:59:30
we get exactly 9 And what is this method
01:59:33
will print if all of its own are equal
01:59:36
interesting three
01:59:40
we compare, we output one thing, and that is, we
01:59:43
we logically conclude that B means
01:59:46
less we don’t know which one but it means
01:59:48
less But probably logically it should have
01:59:52
this is the conclusion of our method in general
01:59:56
I don't draw any conclusions. He doesn't.
01:59:59
says what it means
02:00:02
he just says that if she has more
02:00:05
or it is equal, then we will assume that
02:00:08
and maximum otherwise if not more
02:00:12
what is equal then we will assume that
02:00:16
we do not make a conclusion in this method
02:00:18
different things maximum
02:00:25
this is 3 and 3 is not the maximum value
02:00:28
why does it not correspond to the task from
02:00:31
we cannot choose the maximum of two numbers
02:00:34
so we just take whatever I pour
02:00:37
Maybe there will be 150 of these numbers and in them
02:00:40
there will be several triples and we’ll like these
02:00:44
threes will be the maximum in any case
02:00:47
the rest will be less than 3
02:00:49
accordingly you still have to
02:00:51
choose 3 Correct Because Despite
02:00:54
because we have a lot of threes, we came
02:01:00
and all the rest let's assume numbers are less
02:01:03
than 3 Here But we still need
02:01:05
output some maximum result
02:01:07
comparisons and how in this case not
02:01:10
go this way that both meanings
02:01:13
that's all equal and I really feel that
02:01:16
the gag on this is that they are equal it is not
02:01:19
means that we cannot choose the maximum
02:01:21
from them we simply take either one or the other
02:01:24
the other one doesn't matter to us, they don't care
02:01:26
simultaneously maximum simultaneously
02:01:28
minimal at the same time they are equal between
02:01:31
themselves That is, that they are equal This is
02:01:34
means that they are simultaneously and maximum
02:01:40
understandable Yes, the task here is to deduce not and or B
02:01:44
And the task is to derive some
02:01:47
the value that is between them
02:01:49
maximum Therefore, we don’t care what
02:01:52
lead away Because if they are equal then
02:01:55
any of them is both a maximum and
02:01:58
the minimum is just that they are equal, but not
02:02:01
go deeper into this direction you are leading away
02:02:04
yourself a little out of place and how would you
02:02:07
just put a stopper where there isn't one
02:02:09
as if mathematical logically If two
02:02:12
the expression is equal but there are two values
02:02:15
are equal but you need to find the minimum
02:02:17
at most they are at the same time
02:02:20
minimums are also maximums at the same time
02:02:23
if anyone came to us there
02:02:25
average temperature
02:02:27
some temperature values
02:02:30
hospital and it just so happened that today
02:02:32
all our patients have the same one there
02:02:36
accurate to some sign
02:02:39
temperature, that is, the probability is Very
02:02:42
low but in principle it cannot be said that
02:02:44
there is no such possibility
02:02:47
let's say in 10 patients absolutely
02:02:49
the same body temperature is not
02:02:52
means that we cannot derive the minimum and
02:02:54
maximum This means that today we have
02:02:58
the minimum is equal to this temperature and
02:03:00
the maximum is equal to this temperature and
02:03:02
the hospital average is also equal to this
02:03:05
the temperature is here and we'll let you come to us tomorrow
02:03:08
different temperatures arrived for someone there
02:03:12
40 someone has 36 and accordingly 36
02:03:17
there will be a minimum of 40 there will be a maximum tomorrow and
02:03:21
we consider the average between everyone
02:03:23
values we divide by the number of these
02:03:25
values and output accordingly
02:03:27
average for the hospital But as if
02:03:31
suddenly it happened that they came absolutely
02:03:33
same values probability low
02:03:36
It may well be that's accordingly
02:03:39
It's okay We have the same meaning
02:03:41
We consider the minimum to be the maximum And, as it were,
02:03:45
and we consider it average, so let's go here
02:03:48
now let's look at this method
02:03:53
I want all of them and a little bit of him
02:03:57
it is possible to improve the task a little
02:04:01
grew up because the main thing is to write in general
02:04:03
At least somehow you understand and so that this
02:04:07
the method eventually gave you some
02:04:09
the value you expected to get But
02:04:13
I still want this method
02:04:17
I copied it, I'll just put it here, I did it
02:04:26
look, I still want you to
02:04:29
saw that this is the Max variable for us
02:04:32
There is absolutely no need here Why Because
02:04:36
what do you see if we compare and equal
02:04:41
greater than or equal to B and we let
02:04:44
we say that yes this is true or more
02:04:47
or it will be equal to B then we just
02:04:51
we can write right away
02:04:55
otherwise we can immediately write
02:05:04
then we don’t need this common letter
02:05:07
We don't need extra variables
02:05:10
and the method will do absolutely the same
02:05:13
the most he did before but at the same time
02:05:16
don't use extra memory
02:05:20
he's just comparing
02:05:24
if more then he returns immediately
02:05:29
and there is Otherwise, if not more than
02:05:35
then it returns the value
02:05:41
That is, if you still understand exactly
02:05:44
like this through an additional variable
02:05:46
write to us the main thing is to write but just for
02:05:49
those who, for example, will immediately understand that
02:05:52
no additional variable needed here
02:05:54
that's how this option would be more
02:05:58
then it’s easier Yes, it’s easier, I agree
02:06:02
just like let's say here we look
02:06:05
did not create an additional variable
02:06:09
Max was not assigned
02:06:14
we could do it like this
02:06:19
and return fog but essentially it’s for us
02:06:23
Max is absolutely not needed And by the way here
02:06:25
Java actively swears She speaks online
02:06:28
take it, that is, I clicked that before online
02:06:31
and please, it’s easier to return it right away
02:06:35
the value that we calculate using
02:06:37
we don't need any other method
02:06:40
intermediate triangular here now
02:06:43
let's move on to testing
02:06:46
then now we tested through
02:06:49
That is, this is not called testing
02:06:52
we just printed it like this and double-checked it
02:06:56
so and not so, that is, during postponement
02:06:59
programs Sometimes there is something there
02:07:02
print especially some intermediate ones
02:07:05
results Because if there is allowable
02:07:07
something doesn't even come from somewhere
02:07:10
sometimes it helps, that is, you have to
02:07:12
print but in general We
02:07:16
almost nowhere in the finished version
02:07:20
we won't use it, but now you and I
02:07:23
let's go right here
02:07:26
let's get here to the task in the port and
02:07:30
here we will write methods like
02:07:35
who will test our code but when
02:07:38
this way they will not print the result as
02:07:41
we wrote before that they won’t
02:07:43
print test result
02:07:52
here it was a test Yes, here it was, as it were, me
02:07:58
inside it printed the result for me
02:08:01
checks And now we will not print
02:08:04
check result and return
02:08:06
check result Here and Here let's do what
02:08:10
more correctly let's do it now
02:08:12
let's do it, we'll write a Public method like this
02:08:18
and we will have the result of the check
02:08:21
return I remember that for testing
02:08:23
with us it’s either a pass or a floor
02:08:25
that is, accordingly what type of data
02:08:32
we will return the string because we
02:08:35
we will return either the word pass or
02:08:41
boolean this will be the result of comparison A
02:08:44
based on the comparison result we
02:08:47
Let's just conclude our test
02:08:49
passed or failed and we will
02:08:52
return either a pass or a file, that is
02:08:55
accordingly, the data type. So let's call it
02:09:04
Why are we so called in the future
02:09:07
you will understand because it is very similar to
02:09:10
Real testing of how
02:09:12
our assertions will truly be
02:09:15
look like this, that is, we'll call it like this
02:09:19
and let's assume that it will receive as input
02:09:22
it will get two results
02:09:25
I remember during testing what
02:09:27
results We are always among ourselves
02:09:33
Yes we will compare
02:09:36
just do it in reverse order
02:09:39
The expert cut it off
02:09:48
The expert is this result which is ourselves
02:09:51
ask Yes now I beg your pardon Here
02:09:55
why don't I write the data type because
02:09:59
The expert cut us off maybe somehow
02:10:01
number accordingly and went knitting the number
02:10:04
Yes, and we can compare it with each other
02:10:07
maybe there are some lines I don’t know which
02:10:11
we need to let each other have a method
02:10:14
there are some lines being formed and we need
02:10:16
compare that it was formed exactly like this
02:10:19
the string we wanted to form and
02:10:22
then we will have them because we
02:10:25
now we are doing we will use
02:10:28
polymorphism Let's use this method while we
02:10:34
forget polymorphism while we do this
02:10:45
and what will he do he will
02:10:49
compare them to each other what if
02:10:53
The expert cut it off
02:10:55
equals action-cut
02:10:59
then he will have something to return
02:11:07
pass is correct to give because it is
02:11:11
the test gives a conclusion or the test passed
02:11:14
either he fell over, that is, he will
02:11:20
Here and accordingly Otherwise if the Expert
02:11:25
cut off is not equal to Action it will be
02:11:38
That is what we have In the end, as we see
02:11:42
We do without intermediate
02:11:44
variables That is, something immediately
02:11:48
and we get a method that
02:11:52
upon receipt, experts hit the hall
02:11:56
some exactly the same one he will be
02:11:59
compare these two values and
02:12:02
give some conclusion the test passed
02:12:05
or didn't pass also let's have some more
02:12:08
let's make this method additional
02:12:13
which we will just have it
02:12:18
let's do that is, there is no return
02:12:21
he won’t, but he will publish poetry with us
02:12:27
that is, now we are all our own
02:12:31
starting from today we will count
02:12:34
test cases, that is, some tasks
02:12:38
or there is a history user But we’ll talk about that later
02:12:40
haven't talked much yet, but I hope you
02:12:43
already understand these concepts, that is, from
02:12:46
lessons and theory of what is what
02:12:50
history but let's assume that here we are
02:12:53
create some code to
02:12:56
us some kind of test case we Then could
02:12:58
test And accordingly we
02:13:01
Let's test this code by running
02:13:07
Yes And here we will create a variable
02:13:12
let's make Static so that she
02:13:15
the whole class just owned it
02:13:18
us part 2 I don't want to divide into
02:13:20
Different classes, that is, this code we
02:13:22
let's leave it in the form it was But
02:13:25
usually if you wrote all this by
02:13:28
That's right, here's the variable
02:13:30
Static should be here
02:13:33
because first we announce everything
02:13:36
variable and only then we create
02:13:38
methods but since we have the first part as
02:13:42
whatever the code does not depend on the second part
02:13:44
so just consider it like this
02:13:46
new class but we have an old one Here we go
02:13:50
let's say we're some kind
02:13:58
and Let's say we have it by the way
02:14:08
Let's say we make one
02:14:15
what will this method do?
02:14:18
does not accept parameters
02:14:21
and he will just print
02:14:25
and through print
02:14:28
look then you will see Why after 3
02:14:38
underlining How to denote conventions
02:14:41
and this is our set of poems
02:14:45
so that next time it will be printed
02:14:48
you think that is And now I'll take it
02:14:55
I'll call you here like this No, you know what
02:14:59
I'll add with a plus sign I'll add
02:15:06
let's use the tabs
02:15:11
so now I want to immediately bring beauty
02:15:20
one more so this is just for beauty
02:15:25
so that we can print a quiet set later
02:15:28
the result and look what we are now
02:15:32
now we will do all our results
02:15:34
We will do our homework here
02:15:36
in this way, that is, here I go
02:15:39
here in this our code which I have here
02:15:42
there was part 2 and we forget about these symptoms
02:15:48
Let's comment in general so that he
02:15:51
didn't interfere with us
02:15:53
we don't need him now
02:15:57
so we forget about the purely small ones no longer
02:16:03
And what are we doing? I'm now calling
02:16:09
method for now I have it just print it out
02:16:16
And here I will enter it here
02:16:19
the result of my testing and here it is
02:16:23
let's say how I will check now
02:16:25
your own algorithms your own tasks Let’s say
02:16:28
change everything One because let's say
02:16:30
again don't forget that now
02:16:33
starts today you can
02:16:35
have several cases per home
02:16:38
task Because if you use
02:16:42
different data you must compose
02:16:45
different cases and let’s assume everything that
02:16:48
we have now checked using System Of
02:16:51
Print TV we will now check in our these
02:16:54
methods that we created but only in
02:16:57
form of testing and print
02:16:59
the result and let’s say it’s not the first
02:17:01
case I will set a variable and
02:17:07
which I have is 5
02:17:10
I'll check the same thing further
02:17:14
I set a variable that is equal to 9
02:17:22
So I’ll ask some Expert cut off
02:17:26
that is, my Expert cut it out
02:17:30
these two variables
02:17:33
What value do I expect to get Apparently
02:17:36
maximum so I'm testing my method
02:17:43
accordingly what result do I expect
02:17:46
get from these two values
02:17:50
that is, this part is for each case
02:17:56
almost automated with you
02:17:58
We are now writing an automated test
02:18:01
not yet in a special framework But for now
02:18:04
on your own, so this part is in
02:18:08
automated case is called
02:18:12
parts that are responsible for arange
02:18:18
and spells the English word which
02:18:24
install that is, declare all data
02:18:36
that is, this part of the case She usually
02:18:39
allocated to a separate area
02:18:41
the first one is recorded, that is, let's say this
02:18:44
we have to do exactly like this
02:18:48
there is such a mandatory rule
02:18:51
now we’ll write it down like this
02:18:54
there is this rule called Triple and
02:19:04
Let me write 3 in English anyway
02:19:21
automated And who
02:19:30
we already have this
02:19:36
we write the data that we know
02:19:40
that is, some test data that
02:19:43
we ask and spectrum hall Expert cut off
02:19:47
We should always know in advance
02:19:50
how do we even launch our pelvis case?
02:19:52
otherwise there is no point in checking anything If
02:19:55
we don't know what we have to do in the end
02:19:57
get that there are experts when they salvo us
02:20:00
you should always find out in advance and clarify
02:20:04
as if given more often we get
02:20:08
such data needs to be tested
02:20:11
we get more often from some kind of childbirth but
02:20:15
sometimes we come up with it ourselves because
02:20:17
if we understand what is in this case
02:20:19
let's say there may be some
02:20:22
such unpleasant situations Where is our
02:20:25
program what to fall and our task how
02:20:27
tester to come up with such
02:20:29
unpleasant situations we check them as
02:20:32
We would also test them, but in
02:20:34
without fail we first
02:20:37
We test the data that we were given and
02:20:39
First we Test Happy Past scripts
02:20:43
What is happy Pass PES is it like a way then
02:20:46
there is a happy way What is happy
02:20:49
Test scenario is when we get
02:20:52
correct data and expect to receive
02:20:54
the correct meaning is that here we are
02:20:58
got the correct data
02:21:00
it’s possible to compare Yes, nothing like that there
02:21:03
they are not there, they are part of our area, that is
02:21:06
there's nothing so scary about them And we
02:21:08
We expect to receive some kind of Expert
02:21:11
cut off which Yes is logical correctly in
02:21:14
in this case in this case is called
02:21:17
testing when we enter the correct ones
02:21:20
We use the values for testing and wait
02:21:23
get the correct logical result
02:21:27
then why is this a program of its own?
02:21:30
a program was written to determine
02:21:32
the maximum between two numbers like this
02:21:35
this is this is the first part of Range when we
02:21:38
first we declare all the data that
02:21:41
we know further in this arrived and
02:21:44
pattern there is a second part
02:21:47
and this part is called
02:21:53
that is, in this part in the second part we
02:22:09
method or there for example Let's have one for now
02:22:15
we just don’t know about the others yet
02:22:17
for example call a method
02:22:21
that is, we must produce some
02:22:23
actions to receive
02:22:27
Action cut that is
02:22:36
Action result we get as a result
02:22:40
work of our program
02:22:44
So to get this we have to
02:22:49
in this case we are the only ones to call
02:22:52
while we are working with methods, that is, we
02:22:54
should call this our method
02:22:56
which we test and the result
02:22:58
meaning of this method the result works
02:23:01
he method we must As if appropriate
02:23:04
result and accordingly we will make our
02:23:09
second part We'll take the same
02:23:16
variable and assign the result to it
02:23:21
the work of the method and the method We have here, let’s say
02:23:25
we take this find Max Out Of to
02:23:28
which without numbers Don’t forget the whole numbers
02:23:32
We have already created three methods and
02:23:35
respectively within this methods
02:23:37
We transmit our test data, that is
02:23:48
we Test our method on our Test was
02:23:51
there is what this method returns
02:23:55
assign the variable Action vizal Here
02:24:00
here we have performed some actions for
02:24:16
Asser is an English word that
02:24:20
means comparing the results and
02:24:24
not just a comparison of results, but also
02:24:28
conclude that we have this method
02:24:31
works correctly or incorrectly ours
02:24:34
the test passed or our test failed comparison
02:24:52
how to say it correctly in Russian
02:24:54
draw a conclusion and it’s not a matter of conclusion Of course
02:24:58
you say and conclusion
02:25:07
or fell so this is tripolypata which
02:25:13
stands out of three, as it were, and which
02:25:15
stand for certain things
02:25:18
necessarily components of each
02:25:23
we will learn to write
02:25:28
based on Triple and that is and we will
02:25:32
always talk first let's do first
02:25:35
then we do the second and third and that’s all A
02:25:41
we actually compare the results
02:25:43
happens in the method
02:25:49
they created it themselves, that is,
02:25:52
accordingly here in this method we
02:25:54
we need to pass on ours, that is, look
02:25:58
in what order are the parameters? We see that
02:26:03
first we have to hand over the experts
02:26:07
We take our Expert to the hall
02:26:10
We take Action cut which we
02:26:14
received as a result of the program
02:26:16
experts we ourselves calculated in our minds and
02:26:19
actually we are now
02:26:24
so what better way for us to do this?
02:26:31
let's do this for
02:26:33
convenience and for beauty, that is, it is necessary as
02:26:38
my task would be for you to understand now
02:26:44
my task is to make you understand that this
02:26:47
the method should actually return something
02:26:49
that is, no, he doesn’t print anything, he
02:26:54
returns something Let's do it again
02:26:57
let's do this additional one too no
02:27:02
let's write he will also be Voight and he will be
02:27:06
just print the result of our check
02:27:15
because you don't seem to wrap it up well
02:27:21
so we'll just make a separate one
02:27:24
method which ultimately
02:27:29
Okay, here it will be received
02:27:32
I will pour some meaning, that is, with
02:27:42
so he will print it, that is, he
02:27:48
accordingly as we print
02:27:50
test results then we'll be here
02:27:53
separately pass this verifyls but
02:27:57
this is already like an auto test
02:27:59
that is, it does not print veri files
02:28:02
result let's say so we now
02:28:04
We will also report testing
02:28:07
there is some kind of report about
02:28:10
performing our tests That is, this
02:28:14
it is important to understand that here is an auxiliary
02:28:16
meter print result it is no
02:28:19
our test has nothing to do with the test
02:28:24
I’ll write here that this is our author
02:28:41
the report is our account
02:28:48
That is, we are printing a report on
02:28:52
running our test and what we will do
02:28:59
and here We transmit the result of the work here
02:29:03
this verification method
02:29:06
but this is not testing, this is just printing
02:29:10
result and testing is this
02:29:13
the part where we kind of got a groove or
02:29:16
file Here and accordingly Now if we
02:29:21
Let's print this out all together here I am
02:29:24
launched you see I have one case
02:29:28
That is, let’s say in this form I can
02:29:34
let's create them now, that is, although
02:29:37
would be for one method We are completely
02:29:39
let's test all these values
02:29:42
all values that should be fine
02:29:45
processed without any problems
02:29:48
Yes First we tested 59 now
02:29:53
That is, I had a report for the case
02:29:58
one that he passed me now I create
02:30:05
that's what I do, that is, I have
02:30:08
variables AB and Expert cut off were already
02:30:13
are specified earlier, that is, I just call
02:30:17
mine and assign it the value 3 and call
02:30:21
bi and assign it the value 3
02:30:25
I'm calling the experts
02:30:28
this is just a meaning for me for something new
02:30:31
testing for a new test just like
02:30:35
I already had them announced, I don’t do it
02:30:37
new changes use the old ones
02:30:40
Expert result I expect to get 3
02:30:45
This is what I have
02:30:48
first now I do that is I again
02:30:53
I call my variable which was earlier
02:30:56
no longer existed and I re-entered it
02:31:00
I call the method that I have Fine
02:31:05
numbers and here I pass mine
02:31:09
here and transfer my business to new ones
02:31:12
values and thus
02:31:15
I will have some maximum that
02:31:19
I will be calculated thanks to the work of this
02:31:21
no here But I expect to get something like this
02:31:25
maximum before Misha I do the third one
02:31:34
my method Yes, and there I add the Spectrum
02:31:40
Action cut and this method will compare for me
02:31:44
Is my result equal to what I
02:31:47
I expected to get the result that
02:31:50
I have already received and as a result of comparison
02:31:54
I will receive a conclusion: I passed the test or
02:31:58
the test failed This is what I had
02:32:01
testing, that is, is over. And now
02:32:04
I'm reporting again
02:32:06
just let me do it like this
02:32:10
Remember I called here
02:32:13
I called separately, let me direct him
02:32:16
I'll put it in the report, I'll print the number and
02:32:22
I am printing the result of the work Exactly here
02:32:24
also i will print the number and result
02:32:28
work already new new checks
02:32:33
so now I’m typing this as if
02:32:42
the only thing needed was the system here
02:32:44
write Let's go here where I am
02:32:48
typed by Beri faikvels that is me
02:32:51
I printed two values, but I have them
02:32:54
top two results But I have them
02:32:56
stuck and I need to go here where
02:33:00
there I printed the test result here and
02:33:04
here I'll just do it
02:33:07
an additional empty line and then
02:33:10
now I if I print it out then I have
02:33:12
it will be like this
02:33:14
I passed the first one
02:33:19
How to check that the test is valid
02:33:21
works correctly who remembers from the past
02:33:26
what should I change to check?
02:33:29
that the test really works ask
02:33:33
if I change the crystal experts to
02:33:37
some invalid one and will print it out
02:33:40
my test 2 should fail correctly
02:33:45
So I really have something there
02:33:48
it is considered not just as if it is deduced
02:33:51
first value that comes up That is
02:33:55
this is how I received reports about
02:34:00
it's clear Here at this part Let's do it again
02:34:03
let's write toskase 3 because we are still
02:34:06
checked that we have more bi and
02:34:09
checked when they are equal and now we
02:34:11
we need to check what we have and more and
02:34:15
here we are doing such and such a case
02:34:19
and again we call our
02:34:22
assign it a different value, let's say
02:34:27
call B and assign it to it, let's say
02:34:32
and the Expert untied we expect what
02:34:41
this is what we did, that is, we set those
02:34:45
data for our automated
02:34:47
test that we already know Now we
02:34:51
we do it that is, we don’t know what
02:34:54
will calculate programs from these test ones
02:34:56
data but we call our Action
02:35:00
and here we assign
02:35:05
the value that our method will return
02:35:13
from our test data and now we
02:35:16
do the third part of the osser, call the method
02:35:20
who makes Acer there We transmit
02:35:24
The expert cut off what we asked ourselves
02:35:26
We pass on the action cut what the program tells us
02:35:31
And now we're making reports
02:35:34
this is our part that is responsible for the report
02:35:44
has nothing to do with itself
02:35:46
test us tests can be with reports
02:35:49
without reports this is additional
02:35:53
function it was convenient for us to see which
02:35:56
tests passed and which ones failed
02:36:01
I am typing And now I have please
02:36:03
dragged everything went fine
02:36:07
let's say if I do something strange
02:36:11
value to check what
02:36:13
really mine, I work here
02:36:16
I see what I have here, which means we believe that
02:36:21
ok gives some expected result
02:36:24
that's right, not just the first one that comes along
02:36:30
that is, regarding this part What questions
02:36:37
Irina question Yes, I'm sorry
02:36:43
I don’t know, I swam a little
02:36:52
this is the output just at this point
02:36:56
came up with the name of the variable or did you
02:37:00
it's not a name that goes somewhere
02:37:02
variables are the meter that you and I
02:37:05
we created a little earlier in the lesson
02:37:13
we created three methods, the first one is no
02:37:17
which we have now tested without
02:37:20
Some numbers at the end
02:37:31
the algorithm is considered and the third method is
02:37:35
in principle absolutely identical only
02:37:37
more environmentally sustainable
02:37:40
because they don't use extra
02:37:43
variable but seems to do everything the same
02:37:46
it seemed like everything above
02:37:48
commented out and that's why I
02:37:50
commented on the first part of the lesson
02:37:52
which did not relate to these tasks
02:37:59
we actually have this algorithm which
02:38:02
you dictated it to me, we tested it and
02:38:05
we were convinced that at least get out
02:38:08
destination we receive currency
02:38:10
the result and everything seems to be fine with us
02:38:12
passed all three of our tests as we see
02:38:16
We also passed this report
02:38:20
Thank you for this method that we ourselves
02:38:23
just wrote correctly If we have
02:38:26
everything was on top which means it was commented out
02:38:28
then it didn't work for us
02:38:33
Of course there is no method, there would be no way to
02:38:36
Why do we have nothing left at all?
02:38:39
commented out this is me just here
02:38:42
we did not comment out the code that
02:38:45
we wrote before so that we could publish
02:38:47
only these reports that have
02:38:51
attitude by the method we test
02:38:55
for real But this is all I can do
02:38:58
uncomment Our methods are the same
02:39:01
would work if I did that's all
02:39:03
I’ll document the methods we have too
02:39:09
comment all the time Because there is
02:39:11
part of the code that we tried like
02:39:21
we would still have testing
02:39:24
happened and all the methods worked simply
02:39:28
so that it all doesn't load Honestly
02:39:32
telling me these questions just killed me
02:39:34
because I thought that you were thinking like
02:39:37
about how to write tests and you succeed
02:39:40
sat and thought about what care
02:39:42
commented that is, and as it were
02:39:46
Here, too, it turns out that bi me
02:39:49
I'll have to comment out the second one for now
02:39:55
I just removed everything that won't be there
02:39:59
work because the code is wrong here
02:40:03
But I could leave it all
02:40:06
uncommented it doesn't play
02:40:07
no role for commented
02:40:10
I just tried to tell you the first one
02:40:13
part of the lesson second part of the lesson just us
02:40:16
If only we hadn't seen the report to whom we've seen
02:40:19
I wish I had a bunch of everything printed out. I wanted
02:40:22
so that you see only the latest report
02:40:24
which is this commented one
02:40:28
he has nothing to do with what
02:40:31
we wrote autotests. Not any at all.
02:40:34
no, I just commented on it
02:40:37
so that unnecessary things are not printed so that you
02:40:41
saw exactly what we do
02:40:50
Can I finish? The thing is that Before
02:40:54
today's lesson we somehow wrote everything
02:40:57
our tasks are one page many
02:40:59
the guys are used to the fact that we have one
02:41:01
depends on another
02:41:06
But in general, guys need a little more
02:41:09
to be flexible and not to resist
02:41:12
here's a buck yes here's a box yes what
02:41:16
that's just one way and no other way, that is, I
02:41:19
I'll make one Forest Pie Park and bring it there
02:41:24
all the code that was before and made
02:41:29
I'll move it there and leave only that one there
02:41:32
which relates somehow to testing
02:41:36
But to be honest, you know right here
02:41:39
yours got a little out of whack, that is, not
02:41:43
I understand, I kind of explained it
02:41:45
testing was expecting a question
02:41:47
testing and in the end we got stuck on
02:41:50
some part that is not at all
02:41:53
has nothing to do with anything at all and
02:41:56
you understand that I’m just making comments
02:41:58
for your convenience so that you understand
02:42:02
what happens better
02:42:06
it seems that yes, apparently I'm wrong
02:42:10
that I want questions
02:42:13
new people Yes, but let's do it now
02:42:18
let's separate it so it doesn't bother you, although
02:42:21
I’ll repeat this once again as if it’s all the same
02:42:24
I expected that lesson 5 would already have such questions
02:42:28
won't be so I even a little
02:42:34
we're not discussing that at all
02:42:37
Can I please finish this so
02:42:40
Yes, so that we end
02:42:45
back to how to print
02:42:52
Yes, now I’ll leave it there
02:42:55
just testing me this relationship
02:42:58
I commented it all out here like this
02:43:02
the first part of the lesson and this is the class I
02:43:05
I'll rename it and say that this is the second part
02:43:13
and I’ll say that this is Park 2
02:43:17
and do the factor now go to this second
02:43:22
part and Let's clean it up a little here
02:43:25
code That is all we have left
02:43:27
this is this variable strongly Borodin
02:43:32
method that prints the name there
02:43:36
prints the number the method that prints
02:43:42
the method which is actually our main one
02:43:45
method that compares experts
02:43:52
this is a method that does this
02:43:56
part of the problem and without comparing them gives Well
02:43:59
here we have three methods, then this is
02:44:02
There will be more tasks for us, we are not yet up to them
02:44:11
then what do we have left? Well, now
02:44:15
in fact, our Main method is all
02:44:20
from the first part
02:44:27
in the method We first seemed to call
02:44:31
the result of our method
02:44:38
well, it’s not a method, but it’s what they were looking for
02:44:41
the maximum value was printed but here
02:44:44
in this part we did the author tests and
02:44:48
print for each case here
02:44:52
tested our method and printed reports
02:44:58
We test our method and print
02:45:02
and print reports 2
02:45:07
We test and print accounting for
02:45:10
I’ll bring it out again, that is, everything I
02:45:14
I wanted to achieve this by commenting
02:45:17
code section is so that we print like
02:45:21
if the previous part of the lesson was separate
02:45:24
print the next part of the lesson
02:45:27
doesn’t print, takes a little long to parse
02:45:32
that is, all I wanted was for you
02:45:34
we just saw that now we no longer
02:45:38
print the result of some work
02:45:41
method or some kind of check
02:45:44
or there to see that we all
02:45:46
we did the right thing. What will we do now?
02:45:48
learn any method we write
02:45:51
We will learn to check using our
02:45:56
testing not using
02:45:59
we print some kind of result
02:46:02
which we calculated A using methods
02:46:05
who return something from us then we
02:46:08
this is something that the method returned, we check
02:46:11
through the test and print accordingly
02:46:14
the result of the work in the form
02:46:18
as if it were clear that that part was
02:46:20
commented out just for convenience Not
02:46:23
because there is some
02:46:27
the one that relates
02:46:29
to the method of this problem Find the maximum
02:46:34
meaning between AB it is here in
02:46:37
in this class these are helper methods
02:46:41
so we can print reports and this
02:46:45
our main method which compares
02:46:51
And here, in fact, this is ours
02:46:55
that is, this is one
02:47:05
but then there is auto test 2
02:47:15
too Here it is for every auto test after
02:47:19
how we tested it with
02:47:22
printed a report with the result
02:47:27
Let's talk about this part Everyone
02:47:30
was it clear or do we need to do it all again
02:47:35
I can repeat it not difficult
02:47:38
I have such a small question about
02:47:41
these autotests Let's say we are auto
02:47:45
write tests in each class
02:47:48
as it is asked, it turns out this way
02:47:51
let's say if we need to test
02:47:54
three times something we will ask in
02:47:57
in the same class if something we somehow don’t
02:47:59
we will do as we do at home
02:48:01
task one after another I mean
02:48:07
I don’t know about yours, unless you don’t care at all
02:48:10
It’s clear what tests are. You can
02:48:12
continue writing task number such and such
02:48:16
and there it’s like trying to go do
02:48:19
basically it's like we're trying to move to
02:48:23
auto tests we try to understand that everyone
02:48:26
separate test data is separate
02:48:29
which we check separately if you work
02:48:32
our method is with these test tests
02:48:36
we are still trying to be
02:48:37
testers and not just people
02:48:40
who are having fun with the code so that there
02:48:43
something to watch And this is how it happened
02:48:45
or not so, that is, we will each be ours
02:48:49
test data separate
02:48:51
toskase But if it’s more convenient for you to write what
02:48:54
Let's say task number such and such here
02:48:57
two melancholy out of 3 Write later let's say
02:49:00
task number of some kind and again case one
02:49:05
let’s say with different data it’s just yours
02:49:09
homework starting today
02:49:13
Try not to be there again
02:49:15
print plates with calculations we are more
02:49:18
Let's not just print it like that
02:49:21
inside there is no immediately printed at the same time
02:49:25
no nothing returns him nothing
02:49:27
check that is, we do this more
02:49:30
we won't, we'll write only to those
02:49:32
methods that are basically something
02:49:35
I'm embarrassed and
02:49:37
helper methods that are something
02:49:39
they print and do not return the time purely
02:49:42
Helper methods for printing How do you
02:49:45
you see from all the methods we have today
02:49:48
only two auxiliary And all
02:49:51
other methods return something and what
02:49:53
we will be like the result of our checks
02:49:57
our calculations in homework We
02:50:00
we will try to check with
02:50:03
using tests and printing here's some
02:50:10
Now let's maybe decide
02:50:14
the next option may be more this
02:50:17
it will settle down in my head because now it doesn’t
02:50:19
commented code Now the whole code
02:50:22
which we have it relates to
02:50:23
map for testing and just sort of in
02:50:27
the task that confronted us
02:50:30
Now we have completed this part of the task
02:50:34
found the maximum value only
02:50:38
question please tell me this
02:50:46
Our methods are identical
02:50:50
the third one works for me for some reason
02:50:53
that's right and the second one No, I'm looking at
02:50:55
principle Nothing
02:50:57
there is no difference your meaning is the same as
02:51:11
you understand then I will have
02:51:16
if I ask you something else
02:51:19
do you mean someone else here?
02:51:21
no, I'm trying to check right now
02:51:23
on the correctness of the decision, that is, he did not
02:51:27
passes like a pass when all three and when I
02:51:30
I change Expert for some reason I don’t care
02:51:35
Well, maybe it means something is wrong
02:51:38
algorithm good thanks
02:51:44
I'll post it just interesting, I'm calling
02:51:48
I have the same methods
02:51:59
and it doesn't work for you
02:52:05
it should be like this but we won’t do it now
02:52:09
check later but I still recommend it
02:52:13
to listen and pay attention more
02:52:16
they got confused about what I was saying and what they were typing
02:52:19
forgot, missed something there because
02:52:22
what you can’t do and how in the end
02:52:25
you sit and suffer for four hours
02:52:28
mistakes they listen to what I say and
02:52:31
then it turns out that you listen again and
02:52:33
nothing succeeded
02:52:35
just terrible nothing worked out
02:52:37
actually yes I need to give you a lesson
02:52:40
in order to quickly give you these
02:52:43
some new topics I'm writing code quickly you
02:52:47
so far Maybe it’s not done so quickly
02:52:49
write code + seem to make mistakes
02:52:52
more because you are not out of his head
02:52:55
you invent your own you think through you try
02:52:58
just repeat what I write, that is
02:53:01
sometimes not understanding what is written there
02:53:03
so I still recommend it in class
02:53:06
listen and watch more and then after
02:53:09
lesson try you reproduce the same
02:53:12
the code itself to understand
02:53:14
what is written here but let's do it now
02:53:18
if there is a question
02:53:21
it turns out that in every sand he
02:53:24
still copies itself and repeats itself
02:53:26
there is another better one
02:53:35
ultimately, if we need to test
02:53:37
one method with many data We have
02:53:41
two options about one we don’t know yet
02:53:43
We'll find out soon and what's the option
02:53:47
which we are now trying to do is
02:53:49
here we will be every time for everyone
02:53:51
New sketch create new data
02:53:57
does our method work with these?
02:54:04
Be sure to do it as a separate method
02:54:10
no in any case these are two absolutely
02:54:14
independent from each other
02:54:18
checks it works and this one is correct
02:54:21
method And this method in our program in
02:54:25
our big system has no
02:54:27
attitude towards testing this method
02:54:30
may be specially created there for
02:54:36
for other functions of our system we
02:54:39
Let's test whether this one works correctly
02:54:42
separately taken that thank you actually
02:55:02
with the data that we set and this
02:55:06
we call the method point-by-point
02:55:09
our test and check if it is correct
02:55:11
works and does it work so that
02:55:14
with this data, get exactly this one
02:55:17
Expert potential and based on this we
02:55:20
we conclude that Yes, we have this method
02:55:23
did we pass the test or did we fail?
02:55:26
we can check another one here
02:55:28
some method but not here separately
02:55:32
we can check another method and write
02:55:35
other meanings but as if in this
02:55:39
case we test the method itself
02:55:42
taking a program some algorithm
02:55:44
now we are writing it ourselves because
02:55:49
there are no programmers in the community who would
02:55:51
they wrote us methods that we then
02:55:53
tested these methods in the future
02:55:56
which we are currently testing we will not
02:55:59
programmers A will write this
02:56:02
we will check if they are correct
02:56:06
or wrong that is, we will
02:56:09
receive the data we need
02:56:12
check we will receive or
02:56:25
what the programmers wrote in the algorithm
02:56:29
works correctly or incorrectly if
02:56:33
we have Black Box testing We don't even
02:56:36
we will see this code that we wrote
02:56:38
programmers but we will test this
02:56:42
works correctly They incorrectly A
02:56:44
if we have White Box testing then we
02:56:47
we will see the programmers' code but not
02:56:50
less we will still write
02:56:51
a separate test which is, as it were, with
02:56:54
With this data we call the method
02:56:58
knitted work using the method we
02:57:02
We test and check if it matches
02:57:05
received the room what we expected
02:57:09
getting your own is everything
02:57:12
testing that we are testing some
02:57:14
part of a program or part of code that
02:57:18
written by programmers we make our own
02:57:21
independent tests and we test by calling
02:57:25
this part of the year and accordingly
02:57:28
compare the result that was
02:57:31
obtained as a result of part of the code it
02:57:34
matches what we expected
02:57:36
get if it matches then that's it
02:57:39
a normal program works like this
02:57:41
expected if it doesn't match then
02:57:44
we formalize Baku and say that with
02:57:46
let's say these are the results
02:57:49
this is the kind of data we expected to get
02:57:52
such and such an expert And in the end we get
02:57:55
some kind of failure That is, we have something there
02:57:59
the result was wrong
02:58:01
running our test and this method
02:58:04
Accordingly, we write bugs here
02:58:07
this method doesn't work for us
02:58:11
if we have access to Logan code then
02:58:16
we can also debug our opinion
02:58:18
express Perhaps such and such does not work
02:58:22
code section maybe here here there
02:58:25
in some place they don’t work
02:58:28
because the conditions are written incorrectly
02:58:30
This is our opinion, that is, we can
02:58:32
express the God inside somehow
02:58:35
testers if we have access to the code
02:58:37
or clog and we see what the error is
02:58:40
We think that this is the mistake, but somehow
02:58:43
the decision is not ours Because
02:58:45
programmers get our Bach if
02:58:47
something fell, they are sorting out their
02:58:51
point of view with their advertising
02:58:53
and somehow in the end we come to the conclusion Yes
02:58:58
is this code really not working or
02:59:02
or Our guess was correct and
02:59:06
that's really why the code doesn't work
02:59:07
because we made it easier
02:59:10
programmer composition his opinion but how
02:59:13
it would be all the same then programmers
02:59:15
understand this section of code why
02:59:17
it gave the expected result
02:59:20
But with our auto tests we are precisely
02:59:23
we catch such sections of code that
02:59:25
somewhere they give the wrong result
02:59:29
on this part I understand
02:59:31
I hope you all go to theory
02:59:34
testing that explains all this to you
02:59:36
on testing theory because
02:59:39
in fact, this seems to be the basis
02:59:41
take some tester jobs
02:59:44
test a section of a code program
02:59:48
get some result with those
02:59:50
data that was given to us which we
02:59:54
they came up with it themselves. It doesn’t matter to us most of the time.
02:59:56
the data is given. Here's what to expect
03:00:01
some result and in the end manually
03:00:05
Compare the two with your own eyes
03:00:07
the results did not match write tank that they
03:00:10
did not match or two results matched
03:00:13
tick that yes the test passed
03:00:17
worked fine and he got you here or there
03:00:25
we call our results to some kind
03:00:29
section of code for a large program
03:00:32
Let's work on this section of code
03:00:35
assign variables to Action visual
03:00:37
the result of this piece of code and
03:00:40
as if then specifically using a method that
03:00:45
we get the conclusion they are equal or
03:00:48
equal that is, our longing has passed or
03:00:53
If you have any more questions about this part and
03:00:57
respectively, then either Compose
03:00:59
report or not Prepared more often Compiled
03:01:02
report on which tests were passed Which
03:01:05
fell in Irina Tell me, that is, how
03:01:08
tester we get it in fact
03:01:10
wrote only top and call with
03:01:13
method How to test us Sometimes
03:01:17
has to be a tester to get
03:01:21
perform a lot of actions and
03:01:24
write a big script based on a work
03:01:29
we will write more to receive
03:01:33
now I don't even want to
03:01:45
mostly we will work
03:01:51
but this method is what we do now ourselves
03:01:54
wrote because we don't have access
03:01:57
I planned the framework today at
03:02:00
third part of the lesson
03:02:01
but we are somehow walking slowly Yes, but
03:02:05
We’re unlikely to make it today, but when do we have
03:02:09
will have access to tidy we will already have
03:02:11
built-in method similar to what we have
03:02:14
wrote it yourself
03:02:15
mine we write What to understand how it works
03:02:18
built-in So we will have built-in
03:02:21
this method is a myth
03:02:29
testers, automation specialists will be over
03:02:33
write code to get
03:02:36
and ask this data
03:02:39
either separately in each test or there
03:02:42
ask some data in a large stream
03:02:45
and check that everything worked for us
03:02:48
works correctly on this data
03:02:54
Do you still have any questions regarding this part?
03:02:57
or Let's compare again
03:03:05
morphism I kind of got out of it but I guess
03:03:08
yeah let's go back to the field part
03:03:11
Marfism because everything we will do
03:03:14
let's just copy our method and just
03:03:19
let's do it this way, that is, we don't change
03:03:22
Name let's just make it so that he also
03:03:28
among ourselves but remember that spring through
03:03:41
We will find out why later but definitely
03:03:44
through a point also if we assume
03:03:47
compare two capital letter integration
03:03:49
also through a dot
03:03:51
we will also take let's say the same
03:03:56
and let's make him compare us
03:04:01
If suddenly we need to compare two
03:04:04
results from experts who
03:04:14
which ones we still have there often
03:04:45
but he will return something, either pass or
03:04:49
the meaning of this game
03:04:52
in this Stream all this type
03:04:56
return value what do I need?
03:04:58
transform And please tell me this
03:05:03
in this case we have the name method
03:05:06
may remain the same
03:05:10
incoming data can be of different types
03:05:45
overloading that is, we reboot it
03:05:48
earlier let's say on this line it
03:05:51
worked only with the parameters on this
03:05:54
line the same method now also has parameters
03:05:57
That is, it’s not that intense is no longer
03:06:00
accepts that he is now still from
03:06:02
parameters works but here it is still
03:06:05
from the Double parameters it works
03:06:12
that is, let’s say if I want here
03:06:19
I call please let me choose which one
03:06:24
exactly the method I want
03:06:26
suppose I chose the method that
03:06:30
technically I'm technically again
03:06:34
I clicked on the meter which
03:06:38
but at the same time, let’s say I’ll take it there too
03:06:43
twice That is, he recognizes perfectly
03:06:47
because yes please in this method
03:06:49
Stream is allowed too, that is, but I want to
03:06:54
the same method I called let's say with
03:07:09
if I want it I will call the same method
03:07:13
I can call you because it’s like that for me
03:07:16
it says that I reboot three times
03:07:20
it now works for me with different types
03:07:26
and accordingly here what I will get as
03:07:35
here is what I get
03:07:40
because I have unequal experts
03:07:44
Not because they are this fat because
03:07:48
And this is how I get the result
03:07:51
working with these parameters
03:08:08
it's called overload when
03:08:11
same name of methods and with different
03:08:19
I accidentally called it at first
03:08:34
that is, we overloaded it, she said
03:08:39
we overloaded it, that is, we sort of
03:08:43
made it so that it works with different
03:08:46
parameters We take the same method
03:08:49
and thanks to what we give inside
03:08:51
different parameters hunting remains exactly
03:08:54
we seem to have the same opportunity
03:08:56
then call the same method with
03:08:59
different parameters But if we wanted
03:09:03
would like to create it again
03:09:06
method let's say I take Yes and want to do it again
03:09:11
exactly with two Incas again
03:09:14
naturally I can’t do it anymore I already have
03:09:18
swears this method already exists
03:09:21
there is the same name stylish
03:09:24
parameters of type int already exist
03:09:26
the name is here by the way Absolutely none
03:09:30
it doesn't matter if I try to do it
03:09:36
he's just scared now
03:09:41
that is, But still I cannot create
03:09:44
exactly the same method with the same names
03:09:48
with two parameters because it doesn’t matter
03:09:51
what the variables are called, it doesn’t matter which one
03:09:55
the code inside is written, it is important that I have
03:09:57
method with this name which
03:10:01
takes two type parameters and what is this
03:10:04
the method already exists, but it doesn't exist With this
03:10:08
same name also Takes two
03:10:13
and here is a method with two type parameters
03:10:16
Stream please I can create a method
03:10:19
the same name but with two
03:10:21
with parameters of type Double I can create A
03:10:24
like this I can create
03:10:33
I can only have a problem
03:10:36
there are no comparisons inside, but create exactly
03:10:40
I can because I don't have two
03:10:43
parameters not two parameters I have one
03:10:47
the parameter is different but for us
03:10:54
say what the main parameters are
03:10:58
exactly the data type name
03:11:03
Yes, but in the last lecture you said
03:11:07
about polymorphism
03:11:11
It's either called that or that's all
03:11:14
one and the same Well, in this case yes
03:11:16
That's an example
03:11:18
polymortism is one of the principles we
03:11:21
We won’t go too far into theory, but somehow
03:11:24
for an interview if he tells you
03:11:26
Show us Tell us some example
03:11:33
here you go, you say it’s possible
03:11:36
create methods with the same name
03:11:39
but with different parameters and different types
03:11:42
data and this will work for us because
03:11:46
what do we do in this case
03:11:49
this method and, as it were, one of
03:11:53
examples of the field of Marxism when we are one and
03:11:55
can also be used many times
03:11:59
different guises Think about what it means
03:12:02
word field Marxism That is, we have it
03:12:05
some entity that can
03:12:07
exist there in different guises then
03:12:10
there is here we take this entity this one
03:12:13
method with a unique name
03:12:15
and as if with different parameters of my
03:12:18
we create and this is one of the examples
03:12:26
somewhere else there is
03:12:29
Well it doesn't matter to you
03:12:31
don't bother filling it out so deep though
03:12:35
if you can at least about one
03:12:37
telling it in an interview is already great, huh?
03:12:40
if, as it were, you need it, well, let’s say you don’t
03:12:44
beginner you need to know about some
03:12:46
still go to lessons there I hope so
03:12:50
many different examples How can we help beginners
03:12:53
just remember the baking sheet
03:12:57
we often come across questions in interviews and
03:13:01
as if an answer With such an example already
03:13:09
just understand that if you now
03:13:11
I'll go to theory and I don't have any beginners
03:13:14
will remain and two will not come to me
03:13:17
because they have their own lessons so
03:13:20
let's not get too deep
03:13:22
go deeper divide the tasks here I am
03:13:25
I tell you exactly as much as you need
03:13:28
prepare you for testing and
03:13:31
more or less prepare the passage
03:13:33
Of course, I don’t do interviews for you
03:13:35
I can sit down and learn that this is an example
03:13:47
they wrote that this is how it works
03:13:51
because the same principle works
03:13:55
I can’t torture this for you, I’ll give it to you
03:13:58
information exactly enough to be
03:14:01
enough for you to be ready
03:14:04
hereby testing and
03:14:09
interview, if you have any other questions
03:14:13
except for in-depth theory
03:14:19
please return to 100 31 these
03:14:32
Line 104 we call the equals method and
03:14:37
Line 109 we call again
03:14:41
from under the method already Print and cut 104
03:14:48
result before Return of this method But we are with
03:14:51
We don’t do anything to him. Why because
03:14:54
this one And these are two completely different
03:14:58
area of us maybe
03:15:01
we can't have a report without a test
03:15:08
But this part relates specifically
03:15:12
testing And this is report writing
03:15:18
That is, these are completely two different
03:15:20
this is what we do here
03:15:23
If only we had here
03:15:28
This is where we got the error
03:15:31
problem with Vere Fayta in this case we
03:15:35
we don’t do it, but in a real framework
03:15:37
we will see exactly the error that fell
03:15:39
the test itself And these are just reports and
03:15:46
how would we see this line 104 if
03:15:50
it gives an error, we understand that we
03:15:52
the test was written incorrectly, not really
03:15:56
spelled incorrectly
03:15:59
no what could it be like what we have
03:16:03
Expert of unequals so he gives a failure but
03:16:07
we don't use it anywhere now we don't have
03:16:10
real testing We don't work
03:16:14
we won't have time to get there today because
03:16:17
that we are at some of these moments
03:16:19
we're stuck here But if we had
03:16:25
now we're just doing fails for real
03:16:29
in fact you could value
03:16:31
done using this method, it’s easy to deduce
03:16:36
system outprintella and it would be the same
03:16:39
that is to say, he would simply deduce
03:16:41
we just artificially created the meaning
03:16:44
a special function that gives us
03:16:46
test result is printest cut
03:17:27
But these are two different actions that are important
03:17:30
understand what the test is, this is the test and what
03:17:35
his task is to compare aspects
03:17:38
secials in this case while we are working
03:17:41
here in this, as it were, in this LG shell we
03:17:47
we can't do it in this place
03:17:50
here on this line we have something there
03:17:52
an error occurred, so we just do it
03:17:56
but if we ever get to
03:18:00
our framework will be very similar
03:18:03
method Why we write it here because
03:18:06
what we want is well I want you
03:18:09
understood How the next one works This one
03:18:11
offer which is in this framework and
03:18:14
here are the real rollercoasters in this place for you
03:18:18
will tell you that everything will fail the test
03:18:22
the mistake will go where further
03:18:25
the program would not work without special
03:18:27
given conditions That is, you will fall
03:18:30
heart test and here is the report This is
03:18:34
completely independent actions
03:18:36
prints the result of the check if there was one
03:18:43
but there seems to be nothing here anymore
03:18:47
can't fall because it's easy
03:18:52
I didn’t want to give this to you, but
03:18:55
I thought that you are not a sprayworker at all
03:18:57
you can handle it, so I finally decided that
03:19:00
ok okay we'll write it like this for the most
03:19:03
beginners who use the framework right away
03:19:05
they won’t understand But how about now
03:19:09
it turns out that we need more depth
03:19:11
We don’t have time to go deeper due to this
03:19:15
Because they seem to have questions
03:19:21
no testing problems
03:19:24
relation to the fact that this shell
03:19:27
which we have now created for the project
03:19:30
Java hobi ginners we can't do
03:19:32
differently, so we do it like this
03:19:36
Well, we could have done it differently, but for
03:19:39
this requires another shell and there you are
03:19:41
we clearly saw that we have this test
03:19:44
fell precisely on comparing the results and in
03:19:47
report Yes, what did you do? Well, the report seems to be
03:19:51
in itself it has no
03:19:53
attitudes towards testing In addition
03:19:55
may not exist at all, that is, ours
03:19:58
test without report exactly the same as if
03:20:01
He will get some result right away
03:20:04
compare now I commented out the report
03:20:07
for the first flight
03:20:10
the report will not print but it is not
03:20:13
means that at this point it’s simple
03:20:16
here's one Let's all report
03:20:26
I take and comment on everything unnecessary and
03:20:30
if I print now I have nothing
03:20:33
won't print because I have
03:20:35
reports are commented out as if they were not
03:20:38
exists but doesn't mean anything wrong with the case
03:20:40
I didn't pass, I'm passing here
03:20:45
reports are printed separately yes it is
03:20:48
artificially created situation that
03:20:51
just print it out nicely
03:20:53
test results Because myself
03:20:57
the test itself is just like the real thing
03:20:59
the framework itself is no test
03:21:02
the report does not create, it writes pass or Fail
03:21:05
for a certain situation but the report is here
03:21:09
in such a way that it can be
03:21:10
print it out and demonstrate it
03:21:13
creates to print reports
03:21:15
we either write some ourselves
03:21:17
we attach customized reports to
03:21:20
our testing or use there
03:21:22
ready-made frameworks there are aluminum, for example
03:21:25
which creates reports nothing more
03:21:27
other similar frameworks do this
03:21:31
there is a report that is completely separate from
03:21:34
automatic testing of the situation and that's it
03:21:36
understand that this is what she said
03:21:39
precisely to confirm that
03:21:42
experts are the right people or not equal here
03:21:46
and the report is just us
03:21:48
artificially created some kind of separately
03:21:52
auxiliary methods that are easy to see
03:21:55
Yes, it worked for us in this case
03:21:57
and in this it worked in this it was said
03:22:01
So we will see the report but there is no test
03:22:08
let's probably understand everything further already
03:22:10
then we give nothing
03:22:13
let's not go and do this, let's say this
03:22:17
We won't miss it in time Let's get it
03:22:20
straight from rock But this is what we need after all
03:22:22
must be done How do we find the maximum
03:22:25
value between four variables here
03:22:32
Here they are I'll just copy the Title but we
03:22:37
let's create something like 4
03:22:41
parameters we must go to this
03:22:44
we will also do the method
03:22:50
So there are four parameters and how do we
03:22:53
compare Find maximum
03:23:01
Let's take from all the previous ones received
03:23:05
knowledge Let's try to do
03:23:07
returned equals due
03:23:10
4 parameters and it should return
03:23:14
Let's try to create some
03:23:20
without class methods let's just say
03:23:24
We’ll come up with some kind of algorithm ourselves to
03:23:27
return from four parameters
03:23:29
maximum Let's think about how it's easier for us
03:23:40
I mean take if A and B are greater than
03:23:46
Divide the parameters into 2 groups Yes no
03:23:51
sounded like dividing something by 2 yes
03:23:55
that is, let’s take two groups
03:23:58
parameters and Suppose we compare that
03:24:01
first we will find the maximum between
03:24:08
we Oh, by the way, okay, let's write first
03:24:14
that is, we take and compare what if she
03:24:21
equals B yes then we assign what
03:24:29
we can return it here
03:24:38
we can But we checked all the parameters
03:24:42
Yes, we haven’t checked how here yet
03:24:46
since we can't write returname because
03:24:48
what in this case this method will compare
03:24:51
only and immediately
03:24:55
won't touch it, it's just here for us
03:24:58
need additional variable
03:25:01
no additional variable and here
03:25:05
we just what if we have more either
03:25:09
Let's say that our Max is equal
03:25:14
so because we can't yet
03:25:16
return some value between the two we
03:25:19
could immediately determine and return And here
03:25:22
There are four parameters of us. We are all
03:25:24
must compare with each other so we
03:25:27
create an intermediate variable and for now
03:25:31
at this stage we set the Max variable
03:25:34
let's say yes, if it's more then ours
03:25:39
maximum correct Otherwise
03:25:50
further as you said that we divided
03:25:54
parameters into two groups
03:25:57
Yes and greater than or equal to D yes that is we
03:26:01
let's write the same thing
03:26:04
but only for CD That is, if si is greater
03:26:08
or equals money then what do we have
03:26:12
will be at most equal to 7 And where do we get these
03:26:20
we need one more variable so that we
03:26:24
didn't erase the previous maximum, let's do it
03:26:28
Max is one and let's say that Max day is equal
03:26:41
maximum compare without entering this
03:26:45
Variable Max one is simply Max
03:26:50
we can have a great idea what could happen
03:26:56
divide into two parts
03:27:04
from here calculate some maximum
03:27:07
And let’s say right away that if
03:27:13
Let's add that algorithm anyway
03:27:16
For now, we’ll leave your idea for later and
03:27:19
let's write another one
03:27:20
but if we divided the parameters into two parts
03:27:24
now what should we do
03:27:30
Yes And here we can already
03:27:35
because comparing the maximum from the first
03:27:40
couples with Maxim and the second couple here in
03:27:46
basically so and so Trifa will be like So
03:27:49
that So yeah maybe Let's see
03:27:55
We can already talk to each other
03:28:09
yes otherwise myth otherwise yes we will
03:28:20
And in this case, that's exactly where we are
03:28:24
we can return something because we
03:28:26
have already divided our parameters by 2 by 2
03:28:30
groups found a maximum between two
03:28:34
parameters compared one maximum with
03:28:38
another maximum and as if immediately we
03:28:42
Or could it be like you already said?
03:28:47
there is a second idea, let's do it
03:28:54
what could we do right away
03:29:00
develop your idea
03:29:06
I think this would be relevant if
03:29:08
if we had an odd number
03:29:09
compared parameters when we are not
03:29:12
Could you break it down into pairs?
03:29:20
after we received some
03:29:23
maximum from the first pair we can What
03:29:27
do just to finish this thought
03:29:32
we helped take the maximum and compare it
03:29:37
first and choose between maximum and
03:29:41
bi we already have something there we chose A
03:29:44
now we take this something and say that
03:29:46
if it's something more then maximum
03:29:51
it will be Max, that is, we are not changing it at all
03:29:54
even in principle it’s like this line
03:29:56
excess to receive if the maximum is more
03:30:00
The maximum we have is what remains
03:30:06
look otherwise it will be different
03:30:12
But this line is superfluous, even why?
03:30:16
because you can immediately say that if
03:30:27
everything is maximum Yes, otherwise we
03:30:31
it’s not even necessary because that’s how it was with us
03:30:33
it will stay that way
03:30:36
it means it is greater than or equal to si
03:30:39
before that is not on otherwise we have nothing
03:30:42
must be registered
03:30:45
Yes, go exactly the same way, that is, with one
03:30:48
sides we also have 3 conditions and but the code
03:30:53
in short in this case Yes because we have
03:30:58
how do we get into this area already with
03:31:01
somehow a maximum if this maximum is not
03:31:05
falls under the condition as if he
03:31:07
less then we change it this maximum A
03:31:10
if it is greater or equal then we are as if
03:31:14
our Max remains, that is, in the end
03:31:17
look at our code here, it’s kind of longer
03:31:27
there will be a certain maximum that will
03:31:29
less and less did not compare with each other
03:31:35
compared because we took the maximum from
03:31:40
but some maximum whatever it may be
03:31:43
if he has less than a sieve, respectively
03:31:46
we have become the maximum media and we are here
03:31:49
compare between sindia And if the maximum
03:31:52
whatever it is we have more than that
03:31:55
why do we need to unite
03:31:57
compare with yourself if the maximum is already
03:32:00
more than us then it doesn’t matter at all
03:32:03
let's say we have
03:32:08
234 and they both hit and three is less than two
03:32:13
more than two, that is, maximum less
03:32:16
and maximum less go we did not choose in
03:32:20
watch this moment here
03:32:23
your numbers would give us two
03:32:26
As you say but at the same time 2 you
03:32:32
should be equal to three
03:32:40
now the maximum we had it
03:32:45
that Maxim Less means maximum has become
03:32:48
equal and then Dima let's go and compare
03:32:57
that is, we will check all options
03:32:59
the only black we record
03:33:16
so yeah And now we're in this
03:33:19
the method is missing
03:33:21
Now we have to return exactly that
03:33:25
is there any max as a result of these
03:33:28
checks failed we must return
03:33:32
exactly the Max who came to us at
03:33:37
this line 119 Here is our method
03:33:40
quite now, as it were, a little bit of code
03:33:47
reassignment but in principle exactly the same
03:33:52
could it be done or could it be done
03:33:57
greater than or equal to B or C or D
03:34:02
write it down like this No, she does it like that
03:34:07
greater than B or C not greater than D
03:34:12
No, don't even think about it
03:34:15
It’s wrong to compare like that in this case
03:34:20
and C and D like this
03:34:23
Think this way, sorry about that
03:34:26
interrupts now we'll get stuck and this
03:34:30
it would still just be them
03:34:34
much longer more and there would be a cat
03:34:37
much harder because we would
03:34:39
I had to compare something and more
03:34:42
equal to B and greater or equal and greater
03:34:46
or equals And if nothing hits then
03:34:50
then if Bay is greater than equal
03:34:57
there would still be three left because
03:35:01
we get the result of performing all three at once
03:35:04
Doesn't mean anything that we wouldn't care
03:35:07
would find something greater than or equal to it
03:35:10
all either and no more or equal all but
03:35:14
at most we would still find me in
03:35:16
in this case, that is, it would not have worked
03:35:19
make one through these connections
03:35:22
all comparisons that is
03:35:31
the result of this is this
03:35:37
that is, there is no point in writing oil
03:35:40
what if there is more and
03:35:45
then let's say there is something more
03:35:56
and then write more separate conditions
03:36:02
and then write separately what if conditions
03:36:17
consider that this is our maximum, that is
03:36:20
it would just be an unnecessary action
03:36:23
which is completely unnecessary
03:36:28
that is, it's just oil
03:36:32
re-arranging the same concept
03:36:35
twice in different specific wrappers at
03:36:39
this candy remains candy so we don't
03:36:43
we do it because this is the result
03:36:45
comparisons already either
03:36:48
we get here if we get there
03:36:51
here now just a second
03:36:58
and now let's figure out how
03:37:01
we could also use the method
03:37:04
Let's write down a comparison. Can I ask a question?
03:37:10
Now we have already written two comparisons
03:37:14
We have a disadvantage in this situation then
03:37:17
that he brings out the one and only Max
03:37:19
let's say if the source data is here
03:37:22
Of the four of us, let's say three of us are the same
03:37:24
he will only get the maximum out of us
03:37:27
equal to it and the maximum They can be
03:37:29
if A = B and let's say A = D then we have
03:37:33
three maximum that's good of course
03:37:39
and from these average temperatures according to
03:37:59
and we just need to Find
03:38:11
let's now through
03:38:14
4 value via method
03:38:19
Well, since the Nes method we can immediately
03:38:22
write Return Don't let us think how
03:38:25
the method belongs to us in this case
03:38:27
use Who has any ideas point Max
03:38:31
yes And there you can register four at once
03:38:41
This is one option, but it can be simpler. Let's
03:38:49
No, look as hard as you can, I’ll write later
03:39:16
see I'm at first Max between
03:39:19
in the middle then so that I won’t be found there
03:39:24
I'll insert next month meanwhile
03:39:30
here and then so that it is not found in
03:39:35
result of comparison and previous
03:39:38
comparisons I add here and
03:39:41
I compare with what was found in
03:39:43
as a result of these operations
03:39:46
you see I'm just three times excellent
03:39:51
also without leaving the cash register while you
03:39:56
see what you can do
03:40:05
this is a built-in method but we have it
03:40:08
already our own method which we used before
03:40:12
found the maximum of two We are exactly the same
03:40:16
we can reuse our method that I
03:40:27
I'm writing again again
03:40:44
and this way I will first find
03:40:46
maximum of these two
03:40:49
then so that I don’t have it here
03:40:53
substitute and find between and what
03:40:57
the maximum has already been found and then so that it’s not there
03:41:00
it was found to substitute here and it will be found
03:41:04
mass between Hey and Look, I'm like three
03:41:09
times call the same method that I have
03:41:12
already been and this way I get around
03:41:19
I already have additional coding
03:41:22
were these methods I just three times
03:41:25
I call, substitute different variables and in
03:41:28
In this case, I won’t invest, let’s say, extra
03:41:33
And I just use the method that was
03:41:38
the form, as you can see, doesn’t need these
03:41:42
we practiced all the methods we saw
03:41:45
but in general I could have a task there somewhere
03:41:51
at most just substituting different ones
03:41:55
variables use these nested ones
03:41:58
other methods because when the method
03:42:01
returns something
03:42:02
maximum between these two I am something
03:42:06
I take it and immediately use it in a new method
03:42:09
which already substitutes what has returned
03:42:12
finds the maximum between what came back
03:42:16
and then I take what it returns
03:42:19
I substitute this part again as
03:42:23
parameter That is, I called one three times
03:42:26
and used the same method
03:42:30
I just used different parameters
03:42:38
so we will strive for this
03:42:43
that is, that we will
03:42:45
reuse the methods we
03:42:48
have already created and figure out how to create them
03:42:51
use it to avoid breeding there
03:42:53
a million new methods like we are here
03:42:55
Yes, they have given birth, but in reality they are already for us
03:42:59
we no longer needed it because if we
03:43:03
found the maximum
03:43:05
please we can we can even do this
03:43:09
I don't wrap the method wrapper, we can
03:43:11
just out there somewhere
03:43:14
find the maximum loan several times
03:43:19
much more important in the future when we
03:43:22
let's learn how much
03:43:24
you can pass as many parameters here as you like
03:43:27
Now we have strictly quantity parameters
03:43:30
strictly defined parameters because
03:43:32
that we should write it in advance we
03:43:35
must know in advance how many parameters
03:43:37
we will learn how to pass parameters
03:43:40
somehow common Well, let's say this is the group We
03:43:45
we may not even know how much there is
03:43:47
There will be parameters in the end, but we will learn
03:43:50
find the maximum of all parameters
03:43:53
no matter how many there are, just like that
03:43:57
now calling some of these already
03:44:05
it will work first so
03:44:11
because remember in math
03:44:15
rules We first do what is in
03:44:18
parentheses When we have a lot
03:44:21
looking for the latest
03:44:31
This is what it does and only then works it out
03:44:34
maximum And what has already worked
03:44:41
Well, basically it's identical to this one
03:44:44
So in the future you won't even
03:44:46
create such a method yourself
03:44:50
because we already have a built-in
03:44:53
method from the class with which we can
03:44:55
call any moment and how would we for
03:44:58
it is not necessary to create a new one
03:44:59
method just here we are
03:45:01
trained to understand how it all works
03:45:03
done you will have a similar task
03:45:06
Homework and how it will be necessary too
03:45:09
test But let's go here
03:45:11
we do not test this particular task
03:45:13
we will because in theory we still need
03:45:16
Here are some tasks that will help you
03:45:18
actually almost do my homework
03:45:21
4 hours until we sit, well, let's write though
03:45:26
This is something I planned
03:45:29
so that we don’t have much more time to do something
03:45:31
Well, okay, my problems How
03:45:36
so here I will write somewhere in my place
03:45:40
there was a Main method Yes, unfortunately for now
03:45:43
we get a very good year because
03:45:46
We write everything in the same class, but it’s like
03:45:48
idea planned for you already in the present
03:45:52
It didn’t work out to provide the framework today
03:45:54
so next time we’ll do And there
03:45:57
there won't be so much code anymore
03:46:00
you have to go back and forth like this
03:46:02
scroll search, that is, everything will be there
03:46:05
it will be organized differently
03:46:06
it's easier to see your code for a specific
03:46:09
task but for now it means here we need
03:46:13
write a method that takes input
03:46:15
number pay attention one number from
03:46:21
there are certain boundaries and returns
03:46:26
we write help public By the way
03:46:31
what this method will return what it
03:46:37
before the name of the month the name of the month is
03:46:42
he will return Stream as we do him
03:46:58
and what's going on
03:47:18
let's check the validity
03:47:22
When we have a certain value
03:47:25
boundaries then we must
03:47:28
check this value for validity
03:47:31
it came to us exactly within this border
03:47:34
meaning Because if came 0 We
03:47:36
we don’t even know what to return if it arrived
03:47:39
13 We also don’t know what to return, no
03:47:52
Yes, if we have the number that came
03:47:57
greater than zero and
03:48:11
less than 13 Let's say
03:48:17
we must have it at the same time
03:48:19
and greater than zero and
03:48:23
less than 13, that is, then it will fall into
03:48:27
the one in which we will do something at all
03:48:29
Otherwise, if she didn’t immediately get into our
03:48:33
We'll let this rage be returned
03:48:46
that's when the method returns something, then we
03:48:52
in a word Well, for example, or there will be others
03:48:57
we haven't been through the situation yet, we can
03:48:59
throw an error here But we don't
03:49:03
We're unlikely to pass because
03:49:05
that testing will not be much needed
03:49:07
that is, but in this case it’s simple
03:49:11
for your homework Yes if you don't have
03:49:13
valid value means something
03:49:16
should still return it because no
03:49:18
should return something anyway
03:49:20
even if invalid values mean nothing
03:49:24
This is the method that says:
03:49:26
that he returns 3 still has to
03:49:29
return some Stream in this case too
03:49:31
It's easiest to write down the numbers
03:49:36
here, but if we hit the valid ones
03:49:40
meaning then what will we do
03:49:43
How can we do this in code?
03:49:51
the current that came
03:49:57
assign depending on the number
03:50:12
if number is strictly yes strictly
03:50:18
equal to one more less there namely
03:50:23
strictly equal to one then only in this
03:50:25
in case we will refund that
03:50:30
We're coming back
03:50:38
further accordingly if
03:50:43
strictly equal here we should have
03:50:46
els or just a chain
03:50:53
because we only get one
03:50:56
number and it can only be equal
03:50:58
one thing and accordingly only
03:51:01
we can return one month for each
03:51:03
number if we allow we could on
03:51:07
number 1 return both January and February then
03:51:11
then we would need a chain here
03:51:14
independent but since for each number
03:51:18
we can only return one name
03:51:24
because one excludes the other
03:51:28
accordingly, if it doesn’t seem to us here
03:51:35
can't Why can't somebody
03:51:41
Why does the program check all games if
03:51:45
look if I do it like this then I have
03:51:50
let's say the number 1 came, I have it
03:51:53
check out And that’s why we’re writing now
03:51:57
film Right Why Because reter
03:52:00
stops everything else from working
03:52:03
programs if we have already got here then
03:52:07
we immediately return the Jenners and then we
03:52:10
we won't go anymore so yes the movie is always
03:52:12
we remember right here actually
03:52:15
indeed, if we printed then we
03:52:19
they would go along the entire chain and print
03:52:23
continued further
03:52:26
or they would have checked and not printed but because
03:52:30
what the word retur is worth is very
03:52:33
important word because as soon as we
03:52:37
we got somewhere and we just saw
03:52:40
return I think it's written here
03:52:42
and we fly out of the program here, that is
03:52:46
We're not going any further at all. So yes
03:52:49
movie so accordingly Let's go
03:52:53
I'll quickly copy it so we can have this
03:52:55
a year left then here we have March
03:52:58
That's because you will have a similar one
03:53:02
accordingly and adj. but you probably know
03:53:05
I'll stop here, that is, to
03:53:08
time to waste and that's it I see
03:53:12
the meaning is clear this assignment is clear
03:53:17
and how are we going to write the test because we don’t
03:53:22
Is it possible to write the question more correctly?
03:53:26
via els so that the program does not run on
03:53:29
the whole list or not or one another in
03:53:32
in this case it doesn't matter at all
03:53:34
good because yes in this case
03:53:37
will work as soon as there is some
03:53:42
matches what came
03:53:45
that is, three black will work and then
03:53:48
we won't go anyway if we don't have
03:53:51
we'll go to this one anyway
03:53:53
check But if we have two we will immediately
03:53:56
we will return and we will not go anywhere further and
03:54:00
also selfie That is, we would have
03:54:04
absolutely also Why Because just
03:54:07
no longer depends
03:54:09
from the fact that as soon as we are somewhere inside
03:54:12
hit the letter is triggered and further
03:54:16
independent lcf goes on or simple and
03:54:20
we are completely out of the word program
03:54:24
Return is our exit from the program
03:54:29
we immediately complete the program from the point of view
03:54:33
readability as it was written by everyone
03:54:36
what in terms of readability is it
03:54:39
It's a completely separate conversation because
03:54:41
There is another way to write through
03:54:44
Switch operator Switch and Probably so
03:54:49
don't confuse you even more today, we're going there
03:54:51
we won’t go, but for me personally, yeah
03:54:54
for a tester who works a lot
03:54:57
with exactly these things, what when
03:55:00
there is one case we do this there is another
03:55:02
We'll do something like that there, that's it for
03:55:06
I would be a much more comfortable operator
03:55:08
Switch because it would be better readable on
03:55:19
Select We even pass within
03:55:22
let's not, that's why we don't swear so much at
03:55:26
Javakh make sure everyone knows what it is
03:55:29
Select go to the Evens Well, but somehow
03:55:34
again from a readability point of view
03:55:37
maybe someone wouldn't like it
03:55:40
maybe in the next lesson we will have time
03:55:43
grab a candle, we'll see, but how about it?
03:55:47
Well, I don’t know, but here you already know this
03:55:50
you like in this case it will be
03:55:52
it doesn't matter at all and or and because
03:55:59
in terms of design Yes, I wanted to clarify
03:56:04
you make spaces for future use
03:56:07
do for clarity or readability
03:56:09
or in the future we need to get used to it
03:56:11
write without spaces
03:56:14
on the contrary, now I'll go straight when
03:56:17
I didn’t make any spaces, I really don’t either
03:56:20
you know what they say, my hand hurt but
03:56:22
I thought it was okay so they can see what it is
03:56:26
one block of photos is according to the rules
03:56:28
registration according to our remember
03:56:33
must be put before
03:56:36
spaces because naturally in the future
03:56:39
we basically won't be that easy
03:56:42
I think I did everything the other way around
03:56:45
you have to accustom yourself to always
03:56:48
there was an extra line because
03:56:51
usually we will have something big
03:56:53
a big piece where then there at the end
03:56:55
some kind, that is, it will be considered
03:56:58
much better because if we don't
03:57:01
you need to understand what this method does A
03:57:04
you just need to find out what it ends up being
03:57:06
returns we immediately go and look
03:57:08
Return Yeah, this method returns here
03:57:11
Let's say this, and accordingly
03:57:13
We try to name the variables so that
03:57:16
it was clear that in the end the method
03:57:20
that’s clear Yes, it’s not better here at all
03:57:25
you have to train yourself to write so that there are
03:57:28
spaces before dark on
03:57:35
we still need to write a test
03:57:45
Let's limit it to four
03:57:49
then the conditions need to be changed and then he will say
03:57:53
here is the code commented out
03:57:56
unclear no let's write yes I already
03:58:06
I'm still typing your piece later
03:58:22
next we have August
03:58:28
filming for programming
03:58:30
stelland further we still need 4 months
03:58:45
write next 10 in advance
03:58:50
the bus goes further
03:59:01
and on December 12th everything went to the end
03:59:08
So now let's write a test for that
03:59:11
to test our case let's
03:59:15
let's make only one positive scenario
03:59:18
Happy Pass and one negative
03:59:20
accordingly, let’s repeat at the same time What is
03:59:23
positive What is a negative scenario
03:59:26
we do it here 4 Yes, we already have
03:59:30
just in order and no matter what
03:59:34
we end up testing, we just don't
03:59:37
we share functionality as a rule
03:59:39
go in order there really are there
03:59:42
complex numbers Let's assume that
03:59:45
let's go in order So what do we have?
03:59:49
may be the input data that we need
03:59:51
known for testing if if we
03:59:56
I liked it, I cut off one block
04:00:00
no no input data remember three
04:00:06
input data then we have this
04:00:09
be a variable some number up
04:00:12
I don’t know who will come, I don’t know
04:00:16
Well, let’s say they gave us product picks What
04:00:20
you need to check the number 5
04:00:23
so that the month comes out correctly because
04:00:27
13 salary if he doesn’t work there
04:00:30
the entire organization without 13 salaries
04:00:32
will remain This is conditional and that’s how we take it
04:00:35
some number that they gave us next
04:00:39
data that we already know Which
04:00:43
Expert cut correctly What type
04:00:47
he will be here with us
04:00:51
But we will no longer be able to create
04:00:54
The Expert cut off the variable, then we have it
04:00:56
there was further so we'll do it there
04:00:59
ex-cut or let's say experts
04:01:06
don't learn this stupid habit
04:01:09
how many are cutting Yes but we will do it
04:01:12
let's say this is with us, look with us 4 That
04:01:17
there I am just for your future homework
04:01:20
what is the case number? Better then
04:01:23
Call your experts
04:01:28
and accordingly let's say that this is
04:01:33
us for number 5 We are expected
04:01:40
they said that on the fifth number you should
04:01:45
something else we know
04:01:51
no no let's move on to the next one
04:01:56
that is Black we must somehow
04:02:02
pervert and get the result of the work
04:02:07
that is, we need to create some kind
04:02:17
Sometimes it's just not that easy to achieve
04:02:21
result and there are a lot of actions required
04:02:23
do now it's just that is what we
04:02:26
have to do to get it
04:02:32
call our method call method yes No
04:02:35
be afraid to answer because you will
04:02:38
also at the interview Yes and it won’t happen
04:02:42
Do you think it’s worth saying something better?
04:02:43
say than hang in my opinion yes
04:02:48
we had something there
04:02:52
this is where we will transmit it
04:02:56
Our our test data that is our
04:02:59
give us a variable here inside the method and
04:03:03
we will see if our method will work
04:03:06
that is, and accordingly further more
04:03:09
We don’t need to take any action anymore
04:03:11
already received and call what's next for
04:03:15
in order to compare experts
04:03:25
we don’t write That’s accordingly here we have
04:03:29
is there please in reform which
04:03:31
compare two thongs and we just come here
04:03:34
We convey to our Expert the result that
04:03:39
show which is also for this
04:03:43
so if we launch we won't do anything
04:03:48
we'll see because the report went well with us
04:03:52
Yes, we are missing something here
04:03:56
By the way, we see that the method is not
04:03:59
it worked because there was not enough commonality
04:04:01
ritterna let's do this, look
04:04:04
when this situation happens, by the way, it’s good
04:04:08
that we have poisoned such a situation now I
04:04:11
I'll make the code a little smaller so that
04:04:17
No, it doesn’t work, look what we have
04:04:21
happened here we have a lot
04:04:24
VIPs and method we always have to do something
04:04:27
return but look But unlike
04:04:31
other methods sometimes it happens like this
04:04:33
the situation is that look we seem to be at
04:04:36
every action is prescribed Yes, we have
04:04:39
inside each Ifa there is inside LS there is
04:04:44
but if we have anything in common at all
04:04:49
just that it doesn’t work for the method it
04:04:51
only LS works as a negation
04:04:54
Therefore, if you have such
04:04:57
the situation you described
04:05:00
so newbies don't even think about it yet
04:05:03
Why did this happen Yes, but just take it
04:05:06
in this case remove it
04:05:08
and leave Return for the entire method then
04:05:13
there is and Then look what we have
04:05:16
we will have this
04:05:20
one extra line is not needed here like this
04:05:23
that's what we'll have if we don't
04:05:27
let's get a more valid value
04:05:29
then we immediately return for the entire method
04:05:33
that is, in this case we no longer need
04:05:35
write it off, we will immediately return it for everything
04:05:39
method And if we get valid
04:05:43
values that is, let's go here then at
04:05:46
us for each individual valid
04:05:48
case will return its value, that is
04:05:52
now the error is precisely this:
04:05:55
this is the three turn it was kind of closed
04:05:59
It’s clear what they wrote, but it was closed.
04:06:03
it was dark, it was closed in brackets and
04:06:06
as if for the whole method there is no retur
04:06:09
was registered But if such a situation we
04:06:13
we check for validity then if
04:06:20
just for the whole method and now
04:06:31
worked, that is, we don’t know it
04:06:35
results in this case given worked
04:06:38
our code is 0, that is, the test worked Test
04:06:41
everything is fine there but the result
04:06:43
we don’t know and here we are
04:06:46
you need this part to print the report
04:06:50
and we take it simply and simply copy
04:06:55
we will print another number
04:06:58
case and result please here 4
04:07:02
now we see that the result of you is he
04:07:06
We've had a positive scenario. Let's
04:07:10
now let's come up with a negative one please
04:07:13
sorry, can I put a comment on
04:07:16
about them and the general conditions for the method
04:07:19
my code worked a little with others
04:07:22
conditions the same error happened
04:07:24
but I added I wrote through I added
04:07:29
in this cycle just els And after that
04:07:32
the error has disappeared, that is, the general word is clear
04:07:35
I haven’t written it for the method yet, but
04:07:37
it turns out that each of the cycles
04:07:41
closed and ended on els excellent Yes but
04:07:45
my point is that if you see
04:07:47
error then try something like this
04:07:50
fix it here because
04:07:52
this is your first time working with methods that
04:07:55
Something must be returned Honestly
04:07:57
I myself don’t always know the situations when
04:08:01
you need to write Return for the entire method
04:08:03
when it’s not necessary I just see what if
04:08:06
error I'm going like this is three term
04:08:08
which I have there let's say is the last one
04:08:10
exception of all cases, here I am just
04:08:13
I'll insert it as a return of the entire method if
04:08:16
no error means great
04:08:19
that's it And that's where we got
04:08:28
27 this is the first one prescribed Action and
04:08:31
expected ordinary not a B Oh
04:08:35
sorry yes and it's very good
04:08:38
remark because we need exactly
04:08:40
wow, this is exactly the result
04:08:45
its up to keep in mind that since we are still
04:08:52
let us do this after all
04:08:56
this is also assigned
04:08:59
yes, that is, all the results that Stream
04:09:02
will come here and we will appoint experts
04:09:06
don't create every time just to
04:09:09
remember that the action is Spectrum in this case
04:09:23
that is, in this case
04:09:25
yes here But I won’t correct it anymore but
04:09:29
as if in the future when you are on your own
04:09:41
I don’t know Well, so as not to get confused about what
04:09:51
because we work it
04:09:55
some other leftists
04:10:00
hunger and Yes but Let's figure it out
04:10:04
what a negative scenario we have here
04:10:07
maybe a negative scenario I just
04:10:10
we added it and it turned out that it didn’t
04:10:13
matches the text I'm on the simple path
04:10:15
tested What did you do?
04:10:21
we can't change or can I release
04:10:25
Stream just added a letter there
04:10:28
thought for example did and to check
04:10:30
that everything works correctly, look here
04:10:32
By the way, it’s very good that we came to
04:10:36
this remark that is, look while we
04:10:39
we are working on our
04:10:41
I'll just comment on this in the future
04:10:45
what we managed to write together Yes
04:10:48
This way we don't make negative
04:10:52
the scenario is not a negative scenario it is
04:10:55
we just look at our test in general at least
04:10:58
thinks something goes somewhere and then
04:11:02
may be there What value not to give
04:11:04
but he will still write this is us
04:11:07
we check our test but it is negative
04:11:10
the script is not a test of your work
04:11:12
test negative scenario is what we need
04:11:16
pass some invalid value and
04:11:19
expect some error Most often
04:11:22
this is what is called negative
04:11:24
their scenario may be many others but
04:11:28
in our case we will be more
04:11:30
say that a negative scenario is
04:11:32
when we Pass method Pass
04:11:36
some invalid value and we must
04:11:40
get some that is registered in
04:11:43
our advertising You see this
04:11:47
negative scenario that is given
04:11:49
case that we may have a negative
04:11:56
12 yes And what do we expect in this case?
04:12:02
Yes, we expect to receive our test
04:12:06
still has to pass
04:12:09
because we already have these variables
04:12:12
that is, we still call the same
04:12:15
the very method We transmit the number that
04:12:18
in this scenario we are in the negative
04:12:24
then we'll compare compare ours
04:12:29
received it will be equal to the one we
04:12:32
expect expected accordingly here
04:12:36
We must also get in this case
04:12:42
and how about with these experts
04:12:45
which we already have different meanings
04:12:47
at this point in time we will get that
04:12:51
we have a pass or a fail and we have a PAZ To
04:12:54
we really got it if
04:12:57
would we expect to get there at 13
04:13:01
I don't know some January
04:13:09
This is what we got
04:13:14
because at 13 meters this is the method
04:13:18
to which We Test issues
04:13:21
But what if, on the contrary, in this method
04:13:25
it would have been written down that it had to be returned
04:13:28
If the value is not valid then we get
04:13:32
some month accordingly
04:13:34
the programmer made a mistake and wrote the code incorrectly
04:13:37
and what is the invalid value?
04:13:39
it turns out there is something there, no matter what
04:13:42
the main thing is that it doesn’t work out Era which
04:13:47
all errors are usually indicated separately
04:13:51
in advertising directly separately like this
04:13:56
a lot of attention is lost on mistakes and
04:13:59
error testing is just like this
04:14:01
separate section for error testing
04:14:04
this is not testing there is negative
04:14:07
script sometimes it's not even testing
04:14:09
and there Well, this is not testing
04:14:13
positive scenario scenarios sometimes it
04:14:16
not testing negative scenarios but
04:14:19
error testing sometimes We need
04:14:23
by our actions some specific
04:14:26
error that may occur
04:14:28
user and immunoscreen should
04:14:30
get out This is exactly the error sometimes
04:14:33
reproducing these errors is a whole
04:14:36
a separate area is a whole thing, that is, well
04:14:39
now we're going to talk about this in more detail
04:14:41
we won't talk about this in this case
04:14:44
We are not testing a bug, we are testing
04:14:46
negative scenario because we have
04:14:50
it is called that is, we have it for
04:14:53
outside the limits of permissible values Here
04:14:57
and we expect that some kind of
04:15:02
and that's it, we tested it here
04:15:10
a Probably because I didn’t return everything a
04:15:14
tested for January, yes, that is, a test for
04:15:17
it still passes us by
04:15:19
negative scenario does not mean that
04:15:21
there must always be a file, this means that
04:15:24
yes, with some invalid meaning we
04:15:27
we expect to receive some action from
04:15:30
system what error message is there
04:15:33
or is there something else there I don’t know, that’s it
04:15:36
as if our test is still negative
04:15:39
the script must pass
04:15:42
Do we still have time to solve the problem or is it already done?
04:15:46
or you’ll have time to think for yourself at home
04:15:49
Let's decide let's have time
04:15:53
if possible yes but let's then without
04:15:57
We’ll probably have time for the tests, but still
04:16:00
yes, there are two tasks left, let's do it
04:16:02
let's take this one because it's like the average
04:16:05
calculate you can probably guess
04:16:08
of a family of three, average age
04:16:10
counting is a difficult task No
04:16:16
most likely you will guess this and this
04:16:19
this task can cause problems and so
04:16:23
Let's do it like this, that is, you will have
04:16:25
several tasks similar to this one
04:16:29
task I'm going Insert my task here
04:16:33
I will write methods that relate to
04:16:37
no need to write a method that receives
04:16:40
input distance as decimal
04:16:43
I have the numbers
04:16:46
no public by the way
04:16:50
Yes, I don’t know yet what I will do
04:16:53
return if I don't know I just
04:16:55
I leave I don’t know how it will be
04:16:57
to be called I know what will come at the entrance
04:17:01
decimal number that is from decimals
04:17:03
the numbers we now have are all just W about Flow
04:17:07
we forget we know that this exists But
04:17:10
use W So we'll get some
04:17:14
distance, that is, we will have some
04:17:16
distances That's what's written next to me
04:17:23
that is, this is what I read so far:
04:17:28
should return the distance in
04:17:31
kilometers and meters as text
04:17:35
if in the form of text, then in what type?
04:17:40
yes, that is, in the form of text, here it is
04:17:45
accordingly, whatever the distance
04:17:48
it didn't come as a decimal number
04:17:51
should return text like this:
04:17:54
kilometers so many meters Based on
04:17:57
this number Well, and accordingly
04:17:59
the string will return Yes and Let's call it
04:18:05
Well let's say there
04:18:09
I don't know, it doesn't come to mind
04:18:16
can you just call me something else
04:18:19
nothing else comes to mind
04:18:21
in principle it doesn’t matter. That’s what I called
04:18:23
such a method Yes, it will take some kind of help from me
04:18:26
decimal floating point number
04:18:30
Here's what I need to do to get out of this
04:18:33
numbers pull out the value of kilometers and
04:18:37
meaning of meters Does anyone have any ideas?
04:18:40
divide by a thousand with remainder
04:18:45
let's experiment let's here
04:18:48
we'll do it like this now so that it's
04:18:51
everyone can see how this happens because
04:18:55
if I run the method now it will be
04:18:56
I don't understand why, let's be here
04:19:02
and let's say that let's say something came to us
04:19:08
if we divide it by remainder by
04:19:13
to make it clear that we are at the same time
04:19:19
but we can’t get it
04:19:23
we'll get two and a half yes, let's do it
04:19:26
let's divide it directly by 1000, that is, again
04:19:30
if you don’t know how you go And here you go
04:19:33
so you're just experimenting
04:19:36
Let's see if we divide directly by
04:19:39
a thousand that we will get and we will also get nonsense
04:19:42
and we need to separately pull out the deuce on
04:19:46
what do we need to share so that we have
04:19:48
it turned out to be a deuce
04:19:57
this is if we know what number will come
04:20:00
if we don't know what to know
04:20:04
whole part Yes, and some fractional part, but it
04:20:08
became acceptable 50 maybe Yes
04:20:11
please if it's 20
04:20:23
Irina input number
04:20:25
no matter what it's just decimal
04:20:28
number and you need to take the whole number out of it
04:20:31
part is kilometers and the fractional part is
04:20:38
there you get the remainder of division by 10
04:20:46
Okay, I'll tell you one
04:20:58
if you need to divide 10 then the percentage of
04:21:03
it’s easier to translate into a screw and
04:21:07
cut off then Subtract from one number
04:21:11
see how to get the rest get
04:21:43
maybe first maybe for action
04:21:45
then divide by 10 and take the remainder
04:21:50
let's experiment further, that is, multiply
04:21:53
by 10 and divide by what division
04:21:57
which cuts off the remainder which
04:22:01
stayed for 10 let's see what we do with it
04:22:05
we'll give out what we'll get we'll get 5 but 5
04:22:10
we don't go there, we don't go there, Why Because 20
04:22:15
kilometers point 5 is 20 kilometers 500
04:22:21
correct at 10 per 1000
04:22:25
that is, we need a thousand
04:22:27
multiply Naturally, yes they divide
04:22:38
but there is no operator who is like
04:22:41
the mass is given off by a whole part
04:22:44
Well, for the twenty they already suggested that
04:22:52
what did what? Yes, I just didn’t do it anymore
04:22:57
talk about this that we are for twenty
04:22:59
just take this number and wrap it around
04:23:07
and let's say whatever the number is
04:23:12
in this case we will only get the whole
04:23:16
we will get part of it 20 that is about
04:23:19
don't think about it anymore, I just thought that
04:23:22
it's obvious because someone already
04:23:24
suggested that yes, the whole part is easier for us
04:23:26
just pull it out by wrapping it in a number
04:23:29
having translated you yes then the rest will rush and
04:23:33
here's how to get the correct remainder
04:23:38
5 was 500 meters probably subtract
04:23:43
multiply the result by a thousand
04:23:51
Irina, you can do this
04:23:52
in brackets it turns out what we wrote
04:23:55
int multiplied by 25 is what we calculate
04:24:00
then divide 20:05 by
04:24:06
20:05 divide by percentage by new isolate
04:24:13
no Think Here we get 20
04:24:16
on the contrary, we need from
04:24:23
from our number 205 we need to subtract
04:24:28
the whole part of this one. And then what about this?
04:24:33
that is, yes, this is how we will succeed
04:24:36
Now what is it that something is already all over me
04:24:40
the computer is jumping Let's get the last ones
04:24:43
Let's print it out so everyone can see it like this
04:24:47
But we need it not to be 05
04:24:51
so that it is 500 respectively here
04:24:54
proposal Yes, let's multiply all this by
04:25:06
and we get 500 but with zero
04:25:10
but also take the intent from him yes
04:25:14
see this is how we seem to
04:25:18
together, just not knowing what would happen, we sat down and
04:25:21
picked it up, I'm just showing what's there
04:25:23
in homework it’s exactly the same. Sit down and
04:25:26
you select that is and print and
04:25:42
and that's it, we got separately 20 and
04:25:46
separately 500 that is, accordingly in
04:25:49
in our method we first need this
04:25:53
the number we received as input
04:25:56
translate you go straight to our method
04:26:03
that is, first any number that we
04:26:06
got Let's say that kilometers
04:26:10
the whole part will be
04:26:21
variable that came to us
04:26:24
so then what should we do
04:26:29
from here All our fabrications are here
04:26:33
I'm copying it for you to see
04:26:37
more Clear That's what I copied
04:26:40
that is, now we need the whole part
04:26:47
in this case we see what we are doing in general
04:26:54
and in brackets we what do we take from our
04:26:59
no matter what distance it comes
04:27:05
further we take away from it
04:27:08
a whole part of this one
04:27:14
Well, either we already have this whole part on
04:27:16
in fact, these are already kilometers. Why do we need
04:27:19
count again if we already have
04:27:21
a variable that is exactly this
04:27:24
distance we take away our kilometers and
04:27:28
then we have to do all this
04:27:32
multiply by a thousand
04:27:40
this way it's true
04:27:48
there will be some number of us
04:27:51
which now what we have to do
04:27:54
some two numbers we get that
04:27:57
we have to do with them
04:27:59
convert to string
04:28:02
yes And for this we can for example
04:28:08
make an additional variable A
04:28:11
we can write right away
04:28:14
and here we would say that
04:28:20
let's do it like this
04:28:25
such three until then we have everything
04:28:28
the confidentiality was further we write ours
04:28:44
then you understand why I do this
04:28:49
everyone understands or has a question why me
04:28:57
no, everything is like a string for me
04:29:03
I'm not making an additional variable.
04:29:05
string Yes, I want it right away
04:29:08
everything came back like a string and that’s how I start
04:29:12
from the number So as not to write separately
04:29:15
number touring That is, it’s still me
04:29:18
I just took some empty line
04:29:21
I’ll attach it here and now I’ll have everything
04:29:24
like a string and everything will be seen
04:29:28
and accordingly here I will add more
04:29:34
Russian letter Here it is
04:29:38
And now I have this line
04:29:41
is formed from all this data and it
04:29:44
the same will return in this method
04:29:46
I delete everything unnecessary, here you go, mine
04:29:49
method Well, let's first
04:29:54
let's try it quickly
04:29:57
print I'm already cleaning that is
04:30:03
Let's just people already
04:30:06
diverge then just see that we
04:30:10
we'll really get it Well, let's say from that
04:30:13
same 2 and 5 if she came
04:30:16
We have to get 20 kilometers 500
04:30:20
meters Yes, I just forgot right here
04:30:22
Let’s also add that we’ll work out our method
04:30:28
we are writing a method that will do this
04:30:35
then everything will be beautiful for me two
04:30:38
kilometers 500 meters but now we
04:30:41
we act as testers, that is
04:30:51
Here's a quick look at what we know
04:30:58
6 what we know What data
04:31:05
Yes, what does it have to do with us? Yes, it was
04:31:32
Let's go But this is negativity
04:31:44
but look here we should have 4 coming
04:31:50
Yes, beyond 500 we checked 500
04:31:55
works Let's now here 4 Expert
04:31:58
This is our result In what type
04:32:08
Naturally, we have the text. We are
04:32:11
in the form of text remember all this is returned
04:32:13
that is, Expert, this is such a change for us
04:32:17
already exists so we'll just call
04:32:19
here it is and what we have in experts
04:32:29
Yes, here when you write
04:32:32
experts Be careful not to
04:32:34
make a mistake, that is, and we should have on
04:32:38
in Russian exactly kilometers and 4 b
04:32:43
This is what we should get we expect
04:32:47
then ours, that is, Action from Well, sort of
04:32:53
in the second part
04:32:55
this is what we call our method
04:33:00
and I will believe here Yes and there We transmit
04:33:03
the distance that is already ours
04:33:10
so and what do we have
04:33:14
yes yes I chose the wrong variable
04:33:19
we have to compare call our method
04:33:25
and there we pass our
04:33:30
and compare it with our Action Well,
04:33:35
to see the result immediately
04:33:40
That's what it is
04:33:44
with thongs everything is fine Well, let's see
04:33:49
will our value match, we fail
04:33:54
that is, it did not coincide with this Well,
04:33:59
yeah now we don't know what happened
04:34:01
and yet we have to print
04:34:04
the result of our method and
04:34:09
watch debug what we have
04:34:14
So let's see what we have for some reason
04:34:18
it turned out 6 kilometers 3 meters Who
04:34:21
any ideas why we got 6
04:34:28
because and because actually
04:34:31
when all these translations are coming, remember
04:34:33
there it's a double he does there 399
04:34:38
and at some point this happened to us
04:34:42
this is 399 where we translated you from us
04:34:46
I only took three and this is it
04:34:49
the task is for you to think at home and
04:34:53
I’ll say right away that we are the fourth stream
04:34:56
wrote about your surroundings but there are also you
04:34:59
class its methods, that is, read
04:35:03
Take a look and here it is
04:35:06
Despite the fact that this is a double Despite
04:35:09
that yes it was completely unpredictable
04:35:12
doing all sorts of nonsense with it
04:35:16
numbers in particular together 4 which we
04:35:19
asked can write 399
04:35:22
you need to find something like this
04:35:26
way If we had these numbers
04:35:29
translated correctly, I remember that then
04:35:32
The owl was very indignant that in general Yes
04:35:35
was you working so wrong and then
04:35:37
we wrote separately not so which will be
04:35:39
because we need to round the value
04:35:43
But this is your task, that is
04:35:46
Think because yes you will too
04:35:49
many similar problems there are different numbers you
04:35:53
experiment But the main thing is that
04:35:55
you knew how to write this method That is
04:35:58
he didn't pass here not because I like it
04:36:00
does not work correctly, that is, more accurately Yes
04:36:03
it doesn't work correctly in parts
04:36:05
rounding you need to think about how
04:36:07
round correctly so you understand
04:36:09
How do we pull out a whole part from a number?
04:36:12
fractional part That is, I wanted you
04:36:16
have time to show
04:36:17
this part Do you have any questions?
04:36:21
Let's now do after the point
04:36:25
Well, let's do it. Can I have a stamp?