So now they can see our application is actually running on this emulator.
I can change the value of this five stars rating board to another rally.
OK.
I cannot actually interact with these rating boards here.
OK.
So hopefully that makes sense.
And let's actually go back and say this main activity that I have a fight here and here that actually
create five integer variables so int and the name of these variables is five stars.
Review.
Okay.
And then assign the value zero to this variable.
And for starters you again assign the value zero to the sum of the table.
Int free starts review and assign the value zero to this variable int two stars leave you assign a value
zero to this valuable ain't one star review and then assign the value zero to this variable OK.
So as you can see here we have five different integer variables.
And as you can see we assign number zero values zero to these variables here.
OK so now let's actually typing here PTEN results that said Uncle listener.
Now I want to actually make the Spithead results a listener to the clicks that they use and make on
that button.
So inside the practices I can just type in new view that unclick listener OK.
So now instead of this uncle my Meffert I can put my own codes.
So here inside of this uncreate Smurfette and before this certain click listen and Meffert that we actually
called undisputed results here let's actually create an array of integer numbers.
OK.
So first of all I need to actually specify the Data Type of my Abby and and then I need to actually
specify that I want to actually create an array by putting in a pair of brackets after my type name.
OK.
And now I need to actually give my a name.
So just type in here.
Student reviews OK and then put an assignment operator here and then it's actually instantiate dicere
by actually assigning some values to this Aure.
So just putting in an opening curly brace followed by a closing curly brace and then inside of these
curly braces I need to.
I can actually assign some values to this area.
OK.
So for example the review of for the student in index 0 is 5 3 review for the student index.
Number one is free.
For example 4 2 4 5 1 3 2 5 5 free 2 FREE.
OK.
We need to actually put a semicolon at the end of our statement.
So now inside of this uncle FLSA actually creates a for loop.
So just I've been here for.
And then inside Apprentice's Let's actually create a variable in index and then assign the value zero
to this index variable.
OK.
Until index is less than student reviews that Lynn.
OK.
Here we actually created a condition in which this loop is going to be executed the K until the value
of this index variable is less than the the value of the line of these students reviews.
Ari.
OK.
Index plus plus.
So now let's actually open and close this by using these curly braces.
And here inside of this for loop This actually creates an if statement here.
If student reviews sup index is equal.
So as you can see here double equals operator is actually called equal operator in Java.
OK.
So is equal to 5.
So if the value of the students reviews sup index is equal to number five and then there's actually
the open and closed this if statement by using these curly braces plus plus five stars to review.
OK.
And this means add one value to the value of this five star review and then return that value to me.
OK.
As you can see here it is now showing us an error.
The compiler is complaining here and we need to actually fix this error.
But before that let me try to explain this statement here.
Here I am referring to the name of this array.
Student reviews and here in inside the brackets.
I am just referring to the name of this index variable.
OK.
And here I am saying that if student reviews some index.
So for example the first time that this loop is going to be executed the this index value bet is zero.
OK.
So student reviews sub zero as you can see here.
So the value of this index value bet is zero OK.
And this art piece of court is going to actually give me the value that is inside of the index zero
of these students reviews.
So these five this number five is actually at the index zero of these student reviews.
OK.
So here I am telling that if this value is equal to number five then plus plus five stars review.
So this five star review is actually valuable that we actually created here inside these uncreate method.
OK.
And this variabilis of type integer.
OK.
And here we are saying that as increment the value of this variable by one and then return that value
to me.
So now let's actually solve this problem that is occurring here.
OK.
So just hover your mouse pointer over the error area and see what.
And let's see what's the error cannot assign a value to final variable 5 star review.
OK.
So as you can see here are these five star review value bet is actually declared as final.
And this means that this variable is actually a constant.
OK so if I did it this final achievement here let's see what happens.
Again it is showing us an error.
So let's actually hover the mouse pointer over the error area and see what's the error variable.
For starters the review is accessed video in our class needs to be declared final.
So later in this course I'll talk more about in her classes and in anonymous classes.
OK.
But for now remember that this piece of code.
These are lines of code that actually inside another class.
In order to access the value of these valuable we need to actually declare these variables as final.
OK so in and if I actually declare these variables as final I cannot assign any values to these variables
once I assign a value to them.
OK so in order to solve this problem just select all of these variables.
OK.
And then if you are using any of my choices you need to actually hold the Comanche and then press on
the delay the x key on your keyboard in order to cut.
These are statements these lines of code and if you are using a Windows machine you need to actually
hold the control key and then press on the letter X key on your keyboard in order to cut these these
lines of code.
Or you can actually right click on these lines of code and then you can actually cut here.
OK.
As you can see.
Click on that.
And here let's actually put these values inside of this main activity class.
OK.
And here in order to paste those lines of code if you are using of my choice 6 you need to actually
hold the comma and key and then on the leader Vicci on your keyboard.
Or if you are using a Windows machine you need to actually hold the control key and then press and delay
that BICI on your keyboard.
Right click and this area here and then click on paste here.
OK.
So now as you can see the error is gone.
OK let's actually create another if statement here.
If student reviews sup index OK is equal to number four.
So analysis should be open and closed this if statement by using these curly braces inside of this if
statement.
Just typing here plus plus four stars to review.
And here I am saying that if the value that is inside of this specific index of these students reviews
is equal to number four then increment this the value of these for stars review value.
OK this is our Forrestal's review valuable.
OK.
Again let's actually create another if statement.
If student reviews some index is equal to number three it increment the value of the freestylers variable
and then return that value to me.
OK.
If student reviews sup index is equal to number two then increment the value of the twister's review
variable by 1 and then return that value to me.
And if the value of this student reviews sub index is equal to number 1 then increment the value of
the one star review variable by one and then return that value to me.
OK.
So after this for loop as you can see this is the end the curly brace of this for a loop.
OK here now I can actually assign some values to those takes you.
OK I can actually output some values to the screen.