William Rosener: Welcome back. In this video, you'll learn how to create a simple little great calculator using Microsoft Word.
William Rosener: And Excel basic. Let's start by taking a quick look at what you're going to create and then we'll go ahead and walk you through the steps of creating yourself them.
William Rosener: So we would allow the user to enter in two scores one exam number one on exam number to suddenly get a 75 on exam. Number one, and 85 on exam. Number two.
William Rosener: When the user presses the calculate button we have poor things happen. I'm going to split the average with another passing or failing. I'm saying, the thing about 70 is passing anything below be found their grade and whether they improve. So went from 75 to 85 so this student has improved.
William Rosener: Substantive 595 would be a no. Same here. And they start off with the 95 and two notified how it's improved. Now the student has not improved throughout the semester them.
William Rosener: Okay. And then finally, we'll do a clear button. Well, now that we know we want to do. Let's get started here. So the same areas, you've sent a link to this video, you should also find an interface. Let's start off by take a look at what these are called and
William Rosener: Take a look at their name summer right click on one of them for someone to come here in developer design mode. I'm going to right click, go to properties.
William Rosener: Okay, they can see this is txt exam one
William Rosener: txt exam to
William Rosener: Help your average I'll be I'll pass fail over to Greg and LBO improve and I'm going to go ahead and maybe have just two scores on maybe on the
William Rosener: Floor. I'll have you guys maybe do three of them I think about it though. But anyway, we're have you can enter into exam scores. And then we're going to do the average pass fail grade except for them. Okay, let's get started here. First of all, computing the average
William Rosener: And the very first step. I'm gonna do is come up here to the top. And I'm going to type in Option Explicit
William Rosener: With I am misspell a variable name. I'll get a little warning message limited declare my variables.
William Rosener: And if I knew I was going to hold integers like 123 I could put energy here.
William Rosener: But if I don't if I'm not sure if I want to store, maybe some integers and plug in numbers, I can just leave it as this.
William Rosener: And I could do the same thing with exam. Number two, but since these are now the same time I could come along and place them on the same line, they're
William Rosener: Sort of done it so far. That's going to be the dimension in effect upset some space aside for two variables. They're not going to go ahead and say exam. Number one is equal to the value NTSC on
William Rosener: The exam to is equal to the value
William Rosener: And txt exam.
William Rosener: Soft right in the values. Place the mental variable. OK. So the very first step we're going to do is we're going to now I have read this information have read this information. I'm going to go ahead and place that it's called LPL average
William Rosener: Okay, so I'm gonna say don't do outreach is equal to exam one
William Rosener: Exam two divided by two. And I'm going to purposely have little mistake here and I'll see if you can prove that out. So let's go ahead and run that I'm going to put a
William Rosener: 75 and 85
William Rosener: And I'd like to have the average say 80 but when I hit calculate, it's not. And why is that, and that is because division is going to take priority over addition. So in this case it first did the division than it did edition. So I need to
William Rosener: Make sure I do the addition. First is in parentheses at the two numbers up to two scores then divide by two.
William Rosener: And sure enough, I'm getting at. Okay, next step I'm going to do is display, whether they're passing or failing.
William Rosener: And I'm just going to take a look at the information and help to average
William Rosener: If it's a greater than or equal to
William Rosener: 70 no spaces between the greater and the equal sign. So, greater than or equal to
William Rosener: It's greater than 70 and I'm gonna say LPL pass fail.
William Rosener: Is equal to pass in
William Rosener: Ass.
William Rosener: Okay, so now we're gonna do is I'm gonna take a look. Is there average greater than 70 of somatic the string passing stored in the variable was a mistake failing and stored in the variable.
William Rosener: Okay, go ahead and run this. It's a calculator or not they're passing. If I put in a low score here, they would now be failing.
William Rosener: Okay, next step when you do is display the grade.
William Rosener: To do that, I'm going to come along and I'm gonna take a look is LBO average
William Rosener: Credit than or equal to
William Rosener: 90
William Rosener: That's called LBO grade.
William Rosener: And I'm gonna do this incorrectly. First of all, then I'll figure out
William Rosener: What might be wrong with this code.
William Rosener: So if the average is greater than 90 we're displaying a prison at a be greater than 70 see and I'm just going to simply get an A, B, or C. I'm not gonna worry about these enough right now.
William Rosener: So go ahead and run that to calculate here and I'll tell you what, let's even make sure that they're getting the name. So we'll put 190
William Rosener: Average is 95. What's the see it should be a name. So let's go ahead and take a look at. So right now, their averages 95
William Rosener: So take a look here. I'm gonna go is 95 greater than 90 yes it puts an A in there a split millisecond later, it comes down to the next instruction, it goes is 95
William Rosener: Credit equity. Yes. So puts a, b, then it comes down here is 95 greater than equal to 70 and it displays to see and this is the one that we're going to see
William Rosener: So what we want to do is rather than having these nested all these separate if statements we want to create one if statement so that when that executes so it isn't the first condition executes it falls out of the same with them.
William Rosener: And how am I gonna do that I'm gonna be doing that using the else statement.
William Rosener: Just like that someone to take a look as average greater than 90 if it is I I put in a in grade. I then execute or fall out of the statement and execute the next instructions below. Okay. Now, let me just go ahead and copy and paste this little bit here.
William Rosener: And I'll change this to 7016
William Rosener: In this I'm going to change to just an else
William Rosener: And that'll be
William Rosener: Good. So now what's going to happen as soon as one of these devalues citrus. For example, if it's 95
William Rosener: Going to put in a in grad. And I'm now going to my cursor is going to come down here and execute the next instruction below the have stayed with them. And this one here is going to hand all conditions. So I'm going to take a look as a grid and 80 7060 and this one will handle
William Rosener: 4030 even negative numbers would fall under the if L statement here. Okay, let's go ahead and run that
William Rosener: The calculate button. Sure enough, it's displaying in a. Okay, next step is and then regards to work this I kept like to momentarily is I'm going to go ahead and display whether the student has been improving
William Rosener: So liberal fiber some 80 and 90 that students started off and has improved as the semester progress here. Okay, let's go ahead and I get that running
William Rosener: Coming on down here I would take a look if you wanted to. I'll tell you what, I'll throw a little errand here, see if you can figure out what's wrong.
William Rosener: Is executive to graphical exam. Number one, and on the site LPL improve
William Rosener: People's yes
William Rosener: Statement.
William Rosener: Is exam. Number two equal to exam. Number one,
William Rosener: And I could say something like, no change or
William Rosener: The same as
William Rosener: Saying
William Rosener: Look at this little bit higher on the screen here.
William Rosener: Okay, well no problem with that, but let's go ahead and run it and I'll see if you can figure it out. So I would take a look as exam two grand x equal to exam. Number one, but yes, if they're the same, same. Otherwise no
William Rosener: Okay, let's take a look at the code here. Let's start off with 80 and 92 the student. Improve, yes, they said they went from an 80 to 90 they have improved. How about if we tell us Google hire hundred and 90
William Rosener: Know the students started off with 100 the did a 90. But how about 90 and 90
William Rosener: I'd like to have that say it's displaying yes but I like to have it say no change or the same. So let's take a look here at the code and maybe when you're typing that you figured it out. So I had greater than or equal to I just want greater than. So it's exam to because here is my
William Rosener: Equal. So his exam to greater than exam. Number one, yes.
William Rosener: So the same as what happened there with that you sign is it actually came to this instruction and never even got around checking to see if there were identical. Okay, so that should fix that.
William Rosener: So now I've got 1990 I'm gonna get the same. Okay, next step is we're going to go ahead and ever so quickly. I'm gonna show you another way of implementing the grade use in a slight case the material. So I'm gonna do is double click on calculate
William Rosener: I'm going to grab all this code.
William Rosener: Look up you
William Rosener: Know, double click on calculate to
William Rosener: I can see here's where here's my cursor is private seven sub calculate to and I'm going to paste
William Rosener: And I'm just going to this is the only code. I'm really worried about is right here. Maybe I'll even delete that. And if you wanted to wait. I can see the calculate to you could come up here. I was someplace and
William Rosener: Using
William Rosener: Select case statement.
William Rosener: Okay, where is the top one. And if I wanted to, maybe we could move some of these blank lines up here.
William Rosener: Using statement.
William Rosener: And some on down here and I'm going to do is show you another way to produce some an effect to recreate this right here, the great
William Rosener: Okay, I'm going to go ahead and I'm gonna start a select case statement.
William Rosener: Average
William Rosener: And I'm going to go his case is
William Rosener: Equal to 90
William Rosener: Copy, Paste.
William Rosener: This will be a case house.
William Rosener: Oh, and a half, and then I'm going to go ahead and
William Rosener: Select okay just another way of doing that exact same time one use in the statement. In this case, you send a select case statement. So is average greater than or equal to 90 despite a, b, c, d, or an app.
William Rosener: Okay, I'm gonna go ahead and run that and
William Rosener: Somebody should work on the clear button here pretty simple, the psycho back with am eating and a 90 hit calculate to 85 passing be. And yes, so I should begin the exact same answers. Well, I had calculate one or calculating and that's going to do the clear button.
William Rosener: And I'm going to do is take all these instead them to the knowledge string.
William Rosener: To
William Rosener: Average
William Rosener: Okay, so are clear button should be working now.
William Rosener: And sure enough, so the bottom line is I can allow the user to enter in to scores.
William Rosener: When I hit save. Calculate button, it's going to display the average whether the passing or failing the grade and whether or not they have improved throughout the semester. Often this video you'll learn how to create a simple little great calculator. I'll catch the next video. Thanks. Bye.