00:01
Hello, welcome to this lesson.
00:02
And this lesson we write to java program that x user to input three angles of a triangle.
00:10
The three angles of a triangle.
00:12
And if the total sum up 280, then we'll say it's a valid triangle.
00:25
Otherwise, say it's not a valid triangle.
00:29
All right.
00:30
So we do it in the main method.
00:32
The public or it may so beforehand since angles can be double precision you will actually choose a double type of data to hold the angles of double x y and v so here we would use a scanner to get user input from the console so say scanner let's go to me scaner, just from the pin.
01:46
So we'll print through the screen to tell user to input the first angle.
01:56
So say enter the first angle, say enter the first angle.
02:11
When they entered that, we would assign that to x, so let's call to in.
02:17
That's the goal.
02:22
And we'll call them again.
02:24
And go when they do that we would sign that to why the last but no least okay and what they said we would assign that to z so that's double because we expect and even if they type in 20 we expect that that's that's okay a double can handle that and if they type in we also yeah for some an angle is no waste and integer so the whole precision that's okay for that now that we have x y and z we'll say if x plus y plus z is equal to 180 it's equals to 180 and you will say print so if it happens like they will print it is a valid triangle so it is a valid triangle if this is not true so that goes into the else and brought out to print the next line will say it's not a valid triangle okay so let's give it a try yes to say enter the first angle let me enter 50 single single single single so we have one three over there and go and go our inters 60 yes it's a valid triangle we do that again we'll declare the console so interface angle let me enter 120 .8 and let me enter 40 .8 and let me enter for 40 .2 so that makes it 161.
06:22
Okay.
06:24
Let me enter 2019...