00:01
All right, so for this question, we're basically asked to write a program which will determine whether, you know, a student's final grade is passing or failing, and the final grade is calculated as an average of the foremark.
00:18
So the first thing we need to do is dissect this problem.
00:24
When always when writing a program or an algorithm, first thing you do is really understand what's being asked.
00:28
So the very basic unit that we need to find out is what the final grade is.
00:37
And the final grade, right, so let's say final grade, that is calculated as the average of four marks.
00:48
So let's say x1 is the first one, x2 is the third one, second one, x3 is the third one, x4 is the fourth grade.
00:56
And the average is obviously calculated by summing all the grades and dividing by the total number of grades which is going to be four.
01:03
So this is going to be basically the core of the program or algorithm that we're going to write.
01:12
So you could basically code this in any programming language.
01:16
So to start out with how we would design the actual program itself, we obviously have these variables, x1, x2, x3, x4.
01:25
And these are all going to be you know um float point number so doubles so make sure that these are all uh doubles and if you're writing this in like python or something you don't have to uh name these variables as doubles you can just simply say x1 x2 x2 x4 um so the first thing we have to do is we have to initialize um the variables in the program so you can do this in a multitude of ways depending on how what the specifications are of you know how the program needs to run so you could take an input if you were using java you could do you could use a scanner object and then take system in values and i'm just writing this in pseudocode to make it easier to understand and then you could pass in a value and then assign that to x1 but to make this a lot more simpler what i'm going to do is simple just assign these values manually so let's say the first grade you get is 90 .1 the main step the main important takeaway here is that this is step one of how you're writing your program when you write your program this is the first thing you have to do is you have to initialize these variables you can either initialize them to a preset value that you're given or you can go to the next step and make it a scanner object or take system input from the user itself so the user will put in the four grades one by one and those will become assigned to x1 x2 and x3 x4 so those are like a couple different ways you can approach this but the basic step is you have to initialize these four values first so you have x1 and then i'll say x2 is 89 x3 0 83 is um it is 70 .1 and then x4 is like a 50 .5 um so now that you have these uh four values you're also going to have another variable called final grade or final um just final i think you just do final doesn't really matter you call it um these just variable names and this is going to be the actual uh algorithm part so final is going to say x1 plus x2 plus x3 plus x4 and then um divided by five, make sure you have these in parentheses so that the compiler knows the order of operations...