Lab 1 Lecture-English
Lab 1 Lecture-English
This is
for Chapter one lab. What I'm going to do is I'm going to go over this lab in its
entirety and show you exactly what to do. By the end of this lecture, you'll have a
lab that you could turn in four points. OK, so I'm going to do this whole thing
with you from start to finish. And then what I want you to do is use this video as
a model for the rest of the chapters in the future. What I'm going to do is I'm
just going to go over what you should do, how many screenshots and what code you
should write overall. OK, I won't do the whole thing in this chapter. I will just
kind of give you a model. So anyway, let's go to Chapter one and let's read. I
would like you to take a moment and read to page through all of this through page
ten, I think. Yeah. I'm sorry, to page eight. OK, and then and then after page
eight, I believe it is,
you know, then answer the question. So Glenn paused the tape and read the first
eight pages of the last. Welcome back. OK, so what I would like you to do is then
answer the pre lab writing questions and the learning the environment that you're
working with. So what you do is you take all of this stuff and cut and paste it
into Microsoft Word, which I've already done for you. OK, if you don't have
Microsoft Office or Microsoft Word, you can use another text editor at your
discretion. However, I would like you to know that RCC, if you don't already know,
this, will give you a free copy of Office three sixty for your use while you are a
student so you can go into Web adviser and into your email and take advantage of
that through your Web advisor, the email, through this, through the RCC, not
campus. OK, so then what you do is in the header you put your name, what section
you're in, whether it's CIS or CSC five, there is four sections that I'm teaching
altogether. So and then of course, the class, the class ID number put the class ID
number. I've just put zeroes in here as a placeholder. I would like you to replace
it with your class ID number and then type in the assignment for lab one night. So
you do that in the header so that I have it on every page. OK, and then cut and
paste the questions for the pre lab writing assignment, the fill in the blank
questions and in this case, learn the environment that you're working in. Now, I've
already answered this for you, so go ahead and read the book and then answer this.
And I say what you're going to do is paste this in there and then you're going to
type in the answers. And if you would like to do me a favor, make your answers bold
and read so that someone, an old person like me can see them when you're pasting
the word, when you Pacyga said, please use the aerial font. And because it's the
easiest for me to read. OK, Ariel font about twelve points is perfect. OK, so once
you're doing all of this.
And then you say, OK, learn the environment that you're working with. Well, what
operating system are you using? Everybody is going to have a different operating
system in this class because since we're online, so it's whatever you're working
on, I happen to be working with Mac OSX, Big Surge, eleven point two point one. If
you're working with Windows 10. So state if you're working with Linux, so state
whatever version operating system your house lets C++ environment are working it.
Well, it just depends. I told you to download that being so if you're if you're
working with net being so state if you're working then so state if you're working
with the online compiler, that's fine too. And then the third question is, what if
you're not working, if you're not working in an integrated environment where the
compiler run and edit commands that you will need? Well, this question may not be
applicable. If you're working with Netbeans and if you are working with a command
line compiler, then write those those down and then you'd have to do a little bit
of research to figure out what they are. OK, so that would be the first part of
this. And I, I do usually give a score of approximately 10 points per section that
you're working in. And so finishing this is worth 10 out of 50 points. And so next,
let's move into Lab one point one. All right. So let's let's copy down all of the
instructions here from exercises one, three, four.
Um. And paste this into. Into office. So I have exercises one, two.
Three, and four, so it says here. Log onto the system based on your professor's
instructions, basically you can use whatever compiler you would like and then bring
in first program from the lab, one folder, compiled a program and then run the
program and write what is printed on the screen.
OK, so.
So let's go into let's find out where this is, let's go to the canvas, because I
put this in canvas. All right, and do you see where it says lab manual, source
code? Go ahead and download this.
And then take it out of here, unzip it, put it somewhere where you could find it,
I'm going to throw it on the desktop here and I already have extracted it. And and
then you're going to go to first program
OK, and then this year, just take this and then copy.
And then paste it into a compiler. Now I'm going to use for this first example, I'm
going to use the online compiler that I put in the notes here. So this is for
online. GDB have already pasted it in and then when he paste in, please modify the
comments on the top to state that this is the purpose of the program which is
already there. I just put the purpose in front of it. Your name, whether you're CIS
or CSC five and your class ID number, whatever your class ID number is. And then
the last modified date, this date should be changed frequently whenever you work on
a program and if you work on it, you know more than more than a few days that keep
updating this to the current day. But this will tell you exactly how long it will
give you a record of how, you know, when eventually when you have logged into this,
which will help you immensely. And then it's just going to say run the program. So
hit, run.
And voila, you have made your first program. Congratulations, you're a programmer,
give yourselves a hand. OK, so now you have to prove to me that you did it. So what
you should do is cut and paste, copy and paste the code that you worked on into
Microsoft Word.
OK, then.
Screenshot this the bottom, I see screenshot, not copy, because anybody can do
that, so I'd like you to actually screenshot this. If you are on a Mac, you can use
command shift four and you can draw a box around it, let it go. And it's just and
now it is made a
a screenshot. If you're in Windows ten, you can just use the snippet tool. So here
you take the screenshot that it is made.
And you could go into Microsoft Word here. Let's to make a smaller. And then just
paste it in there. OK, so let's continue on. Uh, so. Now, we've pasted this in
there, we're done, and congratulations, you're on our program or yay,
congratulations. So let's go into Lab one point two. Um.
So let's go into the lab manual and see what the lab wants us to do, so let's copy
and paste this. This is the instructions. And paste that into words. It's easy for
me to read. OK, now let's actually sometimes in the lab manual, the instructions go
over to the next page, so don't miss anything. And then then you lose point. So
let's get the rest of the instructions here. OK.
Copy and paste that into word and then let's go over the instructions.
All right, so we have exercise, one says, bring in program semi propped up from one
folder, compiled a program here. We have a first example for syntax errors. No
doubt you will encounter this in the course. The error message you receive may be
different depending on the system that you're using, but the compiler insists that
a semicolon is missing somewhere and it tells you how to correct the problem. OK,
so most syntax errors are not as easy to spot as this one. This is just kind of a
tutorial on how to do that. And then we're going to recompile it. And then, uh, and
then we're going to answer a question about do you feel that you're getting valid
output? So let's do this let's go into, um, the RCC folder, I'm sorry, here. The
lab manual source code folder go into lab one point two. Which is which is the semi
prob. OK, copy, and. And then now for just just just just for laughs and giggles,
I'm going to use a different compiler this time just to show you how that means
works. And so I'm going to use net means I like the old three point two version
myself. That's. And it works fine, so hit the yellow box, which is file new
project. And then go into the application. C++ application. Now, let's give this
guy a nickname, let's call this lab one section one point two so we know where we
are and then hit finish.
And I just hit the wrong button, let me go copy and paste it again. All right. So
let's paste this in there. So, again, what I would like you to do is I would like
you to state the purpose of the program which is here, and then place your name and
then make sure that you say CIS or CSC five, give it a give. You put your actual
class code in there and then right. Last modified date. And whatever the today's
date is, is February nineteenth twenty twenty one. OK, so it says here on line 15
we need a semicolon. Well let's actually run it to show you where the error is. And
it says here on line 15 you need a semicolon. So let's put a semicolon there and
rerun it. And congratulations, your program works. Now let's do a couple of test
cases to be sure that the number is actually doubling because that's what they're
supposed to do. It's supposed to double. Um, and so, uh. Let's do let's do you
know, two, it's four, so let's run it again.
To let's do one thousand, two thousand. OK, let's do zero zero times zero zero,
that's good. Let's do negative five. OK, so negative five times two is ten. So I've
done four test cases and I can actually say that I haven't run into a logic error
yet. So let's just do some really big numbers, see if it does it. OK, well it
doesn't like really big numbers because doubling that it it goes over the required
amount of memory for this particular, uh, you know, this particular its value. But
that's OK. OK, so now I've done a bunch of test cases. Let's do it. The
instructions say and says nine is the number you type. So actually you can go in
here and say the purpose is to also double any number that might actually be a
little more accurate for the purpose. OK. So anyway, nine times two is eighteen.
OK, great, wonderful. So let's do this, let's take the code.
Here. OK, and then let's go into let's get a screenshot of the output.
OK.
Great. So we've done that now let's kind of make this a little easier for your
teacher to read. So let me put this into Arial, because it's just Arial is just an
easier font. OK. So great. So it says here also an exercise for us. We've done
this, we've done it cut and paste the code and that was exercise three in this in
the program here. OK.
An exercise for says, try running it with different numbers, do you feel you're
getting valid output now? We just did four test cases so you can say something
along the lines of I ran four test cases
And several positive integers and I feel and I am not seeing a logic error except
with very large numbers.
In that instance.
and they talk about why in Chapter one, and I actually will go over that in the
lecture once I pass the lecture. OK, why that is. So let's put the answers into
Ariel. Uh, so it's easy for me to read you, can it or not? I just like easy to read
stuff. OK. So. And that is.
Um, a, uh, you know, exercise one point two, so congrats now completed exercise one
point two. So let's go to exercise one point three.
All right, this house here, we're running this with a runtime error, so let's copy
and paste exercise one point three. I'm sorry.
I already did one point three, I let me go let's go to, uh. I know this is one
point three sorry, let's go to exercise one point three, so let's copy and paste
the.
This is a divide by zero thing that was one point two, so this is one point three
makes make sure I get all of the instructions pasted over into Microsoft Word.
All right, and so I have these five exercises that I have to deal with exercise
one, it says bring in run from that folder, I'm sorry, run from the left folder.
Compile the program and you get no syntax errors. Then we're going to run the
program and then we're going to try to break the laws of nature by asking the
computer to break a lot, a lot of math by dividing by zero, which is like every
scientific disaster film you've ever seen. You can't break the laws of physics. You
know, those those lines from those movies. So it can't be done. Just can't you
know, I need one point eight one gigawatts of electricity. I need know it can't be
done. And so that's my Doc Brown impression. So anyway. Yeah, so you have you have
to be able to define that. OK, so you'll make sense once we do it. And so here it
says Recompile and run the program and ask would ask for the important record, what
is printed, OK, and record the output. Do you feel that. Uh, OK, so run try to run
the program using different values and record the output. Do you feel you're
getting valid output and those are the instructions. So let's kind of go over,
let's find the run product from the lab folder. Um, and then I'm going to, uh. Go
back into net beans.
And do this now. So what you should do is you should save and close your project so
that you have a nice working copy of it in case you need to use it later or in case
I refer to it in another chapter, then you can alter the code rather than starting
over. OK, and that might very well be the case in the semester. You'll you'll see
that a few times. So you want to keep a nice running, a nice running library for
yourself. And it doesn't matter what compiler you use if you use the online
compiler to make sure you save it and then save it into as a project so you can go
back and use it again. OK. Never quit a program or close off any compiler without
saving your documents, because that will come to haunt you later. OK, so you're
going to hear and say, OK, lab one, section one, point three. OK. I noticed that
you can just click on your recent projects to get it. And so we go to here, all
right. And let's pass the code into here, as always, I would like you to give me
the purpose, um, and then type your information here. Name class information,
whether you're serious or five. So state
and the class, I'd never replace the zeros with yours. And then the last modified
date, if you want to type LMD for the last modified date, I'm fine. So we type less
stuff. OK.
Now, let's look at this and let's see what we're doing. Let's run it and let's see
what we're talking about here. Says hi there, please hit a number and hit return.
And so we hit nine and half your number is INF. Well, why is that? OK, so let's
let's type another. No, let's just do zero. And this says half your number is NaN.
So negative infinity, infinity and NAN means not a number. So let's type in another
number, another test case. Let's do negative forty two I guess. And then it says
negative infinity. OK, so you either get negative infinity, positive infinity or
not a number depending on what you type. If you type in a zero you'll get not a
number and you'll get infinity or negative infinity. OK, so let's go back and let's
see how we can fix that. The problem really is a logic issue and the logic issue is
that since divider is equal to zero, it's an integer. And I have it here, we're
dividing by zero. So let's take this number here.
And replace that with a tube, since we are supposed to be dividing it by two, that
would make sense, right? So let's go here and give it some test cases. Negative
five half my number is negative two point five. All right.
Let's go to. 10 1/2, my number is five. Let's go to nine 1/2, the number is four
point five. Let's give this a nice big number one, two, three, four, five. So I
have my number six one seven, two and a half. So I think I'm getting a valid, valid
numbers. So let's go back to nine again, because that's what the. And the
instructions say to do OK, so, uh, so let's do this, let's take the code copy of
the code.
And then paste the code into Microsoft Word to prove that you did it. Uh, and so,
um.
We put that in exercise three, I believe that would work. OK, and then exercise for
will be, um.
You know, type of number and record what is printed, and so let's get a screenshot
of this.
I'm going to paste that into word loops, and that will be exercise for some input.
Put that there.
OK, now it says, run the program using different values and record the output, so
give me like one or two more screenshots of it using let's do negative. Forty five.
OK, so negative. Twenty two and a half. Forty five divided by two is negative.
Twenty two and a half. That seems fair to me. And then let's do a screenshot and
then I'll throw that in there. OK. All right. And uh. Let's do another one, let's
do, uh.
One thousand five hundred, that seems fair to me. So, um.
In two test cases is perfect. In this example, all right, so we've done now that
exercise five, do you feel you're getting valid output? So I would say yes, because
I, uh, after I replaced the deviser two two, I get accurate. Uh. Output.
When entering.
The, you know, several numbers, as I stated, an exercise for something along the
lines like that. OK, so there's that.
This, you know, I would like to make the answer a different font so that it
separates it puts it apart on student Ariel because it's easy for me. And then same
thing with this. And that's exercise one point three, and we've done it. OK, so
let's continue on to exercise for.
I think I misspelled divisor. OK, so let's do exercise one point four stated in
here. OK, so working with logic errors.
So it says exercise one, bring in the program Logic from the lab one folder.
Oh, I didn't state lab one point four, did I? I should have done that. I mean, just
me cut and paste both of them. Into Microsoft Word. OK.
And that's the end of it. OK, great, so. Let's go in to hear.
So bring in lab logic when problems seep from the lab, one folder. I don't need to
see the original code, it's fine. And then compile the program, get no syntax
errors, run the program, what is printed, and then the problem has no runtime or
logic errors, but it certainly has a logic error. So. So this creates a challenge.
I would like you to correct it and fix the problem. So let's let's do let's do this
together. OK, so let's go into the lab manual and bring in the one point. Uh.
I'm sorry for one point, for. Let's bring in logic problem. That CP.
OK, and I'm going to throw this into. Net beats. Let me pause recording my
battery's dying one sec. OK, so now I'm back anyway. Let's do.
To, um.
Net Beans
All right, let's close this project and save it. Don't don't ever put into Section
two different projects in the summer with the same, um.
Within the same project, because it will air so lab one, section one, point four is
what we're working on. OK, so source files. Uh, OK, so let's get this pasted.
Again, let's let's give me the purpose, which is which is the purpose of the
program is this obviously the purpose and labs will pretty much be give it to you.
There are times that you'll have to type it in yourself when you're doing projects
and things and in some cases when you're writing from scratch. So let's go into the
CIS or put your name there, or CSC five and then the class code as well, which will
differ depending on the class. And then the last modified date, which I'm going to
shorten to LMD and then we'll say February nineteenth twenty twenty one. All right.
So going into first and second. So what this program is supposed to do is swap
between two numbers. All right, let me run this. Let me run this thing for you and
let's do in the first number two and then the second number five. Notice that it
doesn't it doesn't swap. It just overwrites. So that is the logic here. OK, let's
go to order to be able to do this, let's just look at the code and see why it's
doing that. OK, so we have two numbers. First number and second number.
And then the first number is going to we're going to get information and hit, uh,
you know, information from the user for the first number and basically this is my
prompt. This is the where I pause for it. That's the second statement. And then
that's for the second number. So for the for the for the output. It's just we have
two numbers here.
This is the I'm sorry, this is the input, this is the two numbers you gave me, and
then we're going to swap the values and then have the output. So since the value
swap isn't working properly, we assume that we that this algorithm is not is
incomplete or incorrect. OK, so we have to alter that highlighted area and I have
to give it another I need another variable. So I'm going to need a temporary
variable. So I'm just gonna say temp. OK, so I need a third number to swap to
basically when you're swapping between two numbers and you copy one number to the
next, it doesn't swap them. It just overwrites. So I need a third place in memory
to hold temporary data so I can swap. OK, so this number here is the first number
entered by the user and this is the second number entered by the user.
OK, so here, how does this work? OK, so instead of sending first number to second
number, because that's beginning the overwrite. All right. And basically this is
backwards, so I'm actually doing it backwards. I'm sending the second number to be
held by first number, OK? And then I'm setting the first no to the second number.
OK, so somewhere in there, I have to I have to send it what is typed in first. And
send that into temp. OK, so let's do that temp is equal to first number.
Now, what we have to do is after we send the first number into temp, now we have to
pull the temp, we have to get the second number, and then we swap the second number
into the first number. Right. So the first number has to then go to the second
number and then the second number gets whatever is in temp.
OK, so let's run this thing and see how this works, so let's do two and five again,
and now I have that problem in reverse. I still have an overriding issue. So this
is the logic that I use. First number is going to go into temporary, OK, then the
first number is going to go into the second number and then to temper is going to
go into the second number. Where have I made an error? I'll give you a second to
look at this because I made an error somewhere. Basically, what I did was I, I, I
did it backwards. OK, first, it's not first number that needs to go into second
number. It's second number needs to go into first number.
OK.
And then we tap into second number, so let's do this, let's do two and five, and
then now I swap the two things and I completed my my my logic error program. So
congratulations, we've done this. OK, so let's go back in to make sure that I have
nothing else to do. So OK. OK, so, uh.
OK.
So compile the program, run the program, what is printed. OK, so basically when we
answer this question, the what is what is printed in the program, that is the
program overwrites.
The value.
so therefore.
And so and then this program has no syntax or runtime errors and has a logic error.
So actually after exercise, four of us cut and paste what we've changed.
Oops, I can't say that since we have a large, rather large swap. Oh, no, we don't.
We don't actually. So let's take this and let's get the output of this.
And now we've completed that assignment, so we have done one point for let's go
over one point five and then then when we're done, you have an assignment that you
can turn into me for 50 points. So congratulations on getting this done. So anyway,
let's go into the lab manual and let's let's writing the first program. Now, here
is a big hint. When something steps optional, chances are it's not. I'm going to
want you to do it unless I specifically tell you not to. I'm going to want you to
do all of the lab. OK, so just so you know, in the future, don't ask me if
something's optional, I probably will assign it. So this is not optional. I want
you to do it. OK, exercise wants us to develop and design. That leads to an
algorithm. And the program will read in the number of mile a number that represents
the kilometres travelled and the output will convert a number to miles one
kilometers equal to six point two one miles. Call this program kill to Kill two
miles. OK, so compile the program. And if you get compile errors, try to fix them
and recompile so your program is free of syntax errors. Then run the program. Is
your output what you expect from the input you gave? If not, try to find the logic
error and run the program again. OK produces the correct result. So what I would
what you need to do is we need to plan this thing. So let's go over some
pseudocode. And then we're going to diagram it up and then we are going to output
it. OK, so the pseudocode is that we should probably start, let's say, start
program for KiloToMiles. So what we're going to do is we're going to take a
kilometer and we're going to convert it. So we're going to take a Number as input
Then read in the kilometres travelled and convert it to Miles. OK, so we need to
get get the number of kilometers
From user, you know, and so, uh. You probably ask user for, uh.
Kilometers get the number of kilometers from the user and then we're going to do
the math so the math part will be calculate
miles from kilo's. So that will be one K is equal to one one one kilometer is equal
to, uh, point. Uh, six to one, Miles. OK. So what does this look like in math
problem? Well, since we have to calculate the miles, let's say Miles is equal to.
Uh, one, uh, whatever the kilometers you traveled in, times, zero point six to one,
OK. So that would be the math portion of it, and then the result is then output,
Miles, to user, uh. And then display output in a way that makes sense to use her.
OK, so that would be kind of the. This is the start of the pseudocode, right? So
how would you do a flowchart for this? Well, you need a you need diagramming
software. I have it already in my computer. I call it a draw. It's that you can you
can download. You can go to http colon double slash draw dot IO and either use it
in the browser or download it on your computer. I have chosen to download it. OK.
Oh, I need update. I guess I haven't used this in a long while. Let's wait till it
updates.
So we're going to create a new diagram. OK, and let's just do a blank diagram now.
As if you've read my handout for flowcharts, and if you haven't, please pause this
right now and read my handout for flowcharts before you start this, you will make
more sense this way. OK, so I'll I'll pause, pause the video and go read it. I'll
wait. OK, welcome back. So what you do is you use and elipse, there is there is all
these wonderful things, a parallelograms, squares, rectangles and all sorts of
nifty stuff. OK, so let's go. Let's use the Ellipse for start to finish. I think my
diagram, my hand out does state this is a circle or ellipse or something. I like I
like to use the ellipsis for my start in my end. OK, so will say start. I'll refer
to start KiloToMiles the program and then we're going to end the KiloToMiles
program. OK, and then we're going to use pretty much parallelograms and rectangles
to determine between output and input. OK.
So when you're displaying things, you use a rectangle or when you're getting data
in or out, you're displaying input or output, you're displaying this in a
parallelogram. When you're processing, doing math, you're displaying this as a
rectangle. So we have this and then we have directional arrows. So what I would do
is I would start by snapping a directional arrow to an output process at the
beginning. OK, let me go in here and then we can type in something along the lines
of what we did in pseudocode that says, if you remember in Microsoft Word, it says
here, ask user and get the number of kilometers from the user. Now, I do know and I
do understand that my output says put these in two boxes and that there's nothing
wrong with that, as a matter of fact. I would like to encourage you to do that. But
since they are the same process, you can also combine them. And if they're not
being separated by another process, you can combine two processes together until
they are separated by another another process that interrupts them. OK, now I'm
going to connect this here. And so that it will it stays, stays. But now we're
going to do the math part, right? So this year will be one kilometer is equal to
zero point six to point six to one miles, which will actually translate in math as
miles is equal to, uh, kilometers times. Point six to one. OK.
Now, I'm going to connect it again to my output process here. See how it moves
nicely, I can you know, it is all connected, so let's go into my pseudocode here
and we're going to have to output miles to the user and display that in a way that
makes sense.
Connect that to the end of the program and congratulations, you have now done your
very first flowchart for a lab in the future. This is I'm only going to want
flowcharts in this particular lab. I'm going to give you a other assignment to do
flowcharts. OK, so.
So anyway, let's go to export and export this as a PNG. Why PNG? Because I get a
really nice, wonderful, um, do a transparent background. I guess I get a really
nice, wonderful, clear view of this in Word. Let's just say that this is one point
five diagram for that PNG.
OK. Uh.
So when you say that it's going to save it into the documents folder, I'm going to
throw it onto the desktop just because it's a little easier to for me to see there.
Um.
So there, there. That is OK. Now, what I recommend you do is you save all diagrams
for future use, because when you're it's really painful if you're going to be
working on this and let's say you are in a more complicated lab, you get this
wrong, I'm going to expect you to go back and fix it. And there will be other cases
where we're going to alter flow charts from previous weeks and you're going to be
working on things over a period of days. So it's good to save the original document
so you don't have to reinvent the wheel every time you want to alter this. So it's
a good idea to save it. So it's going to try to aio. And let's save this somewhere.
If you want to give it a place to save it, it will always save your documents
folder unless you tell it otherwise. So if you want to put it somewhere else,
that's totally fine. But let's just say this is one point five. Uh, uh
Okay, so now I have it in case I ever want to save it again. OK, so let's get rid
of this program and let's put this wonderful thing into, uh. You know, into this is
my flowchart and, uh. Let's put it in here. OK, and then now. Now that we have a
flowchart, let's code this wonderful thing, so I'm going to go back into net Beenz.
And, uh.
All right, so let's close the previous one and open up a brand new, um,
application.
Now, OK, so let's let's show you what this is, this is a nice, wonderful little
shell here. Let's make sure that we get rid of this. And most just say Paon include
Io's dream and the wise in the lecture. But I'll post in a minute so the author
will be you. And then in addition, if we can do your class information so that. See
this.
Uh, CSC five and then the number. OK. Um, since we created this on February, that's
going to be the last modified date so we can alter that to the last modified date
and then let's give me a purpose. This type of stuff doesn't really, truly matter
that you get rid of that. So what is the purpose?
And let's follow the first bubble in my flowchart, which is you ask the user for
kilometres and get the number of kilometres from the user. OK, so we all need a
interface that says enter the number of of, uh, kilometers.
Then put that inside of quotes. Should have done that in the beginning and I didn't
do it. OK. Into the number of kilometers that maybe do a colon and a little space
so that everybody knows, uh, where to enter the kilometers. OK, then we have an
int, uh, and then we say, uh, kilometers. So we probably should, uh, type in, uh,
you know, maybe make I think I'll do these as floats. So float. We'll need to, uh,
instantiate two variables. Floats that are floats. Um.
Yeah, kilometers and miles. OK, so in four kilometres and then you should probably
confirm that you type that they typed in.
Oh, no, let's do actually, let's get let's do the math for that, so the kilometers
I'm sorry, the miles is equal to kilometers times point six two one, and so we can
put a note here that says, uh, point six to one mile is equal to one kilometer, you
know, so we know. And then let's put a semicolon at the end of it. Don't forget to
do that. And then we have an output. That's what we've done. We have an output that
says a C out.
You entered
Kilometers and went and, uh, uh, that converts to and then have a, uh, another
stream and then maybe a space and then say, uh oh, I'm sorry, we should say Miles.
And then another strain that says, Miles, OK, so that will display as you enter
these many kilometers and that converts to so many miles.
We kind of, uh, uh, you know, make it a little more fun for the users and then,
well, let's give it a semicolon. So let's run this thing and see if I am correct.
OK, no errors into the number of kilometers. So listen to one to test to see if I
get it. That will convert to zero two point two one miles. Thank you for using
until tomorrow. So let's, uh, let's give it a bigger number five. That sounds about
right. OK, cool. So let's just verify, um, let's go to Google and let's verify.
Five kilometers. Two miles and you'll get three point one zero six eight six and I
have three point one zero five eight rounds. I don't. So it's good enough for
government work, I think. And, uh, let's actually do a negative number just to see
if I get the same thing I do. And so let me just do something like one hundred
kilometers. That's sixty two miles. So when you figure that L.A. from Riverside is
about sixty five miles, then we just learned that L.A. is a little over one hundred
kilometers away. So congratulations. That's great. You can use this now. I want to
see your code. Uh, so the code that you typed in should be here. So you do this and
you copy this into, uh, you know, the code into here and then I want to see a
screenshot of it working.
And then let's throw this in here. OK, there you go. And so we have now just
completed lap one. Let's save this so that we don't get lose it, because that would
be terrible if we lost everything. So I'm going to put it on my desktop really
fast. I'll say I'll save this as an Laskey. You should put your name in there, uh,
lab one or however you want to name it. Now, how do you get this to me? OK, you can
just upload this Microsoft Word document. You can also save this as a PDF file just
by going file save as and then choosing, you know, PDF as your output. You can do
that as well. There's nothing wrong with that. Um, and you can give me either file.
Which file do I prefer. I prefer the Microsoft Word file because the browser for
some reason likes to render word files faster than PDF files. And so it takes me a
little less time to grade. But either way, you do it the only time. You absolutely
have to give me a PDF files. If I'm not if you're using a software that I'm not
using, like OpenOffice, I don't have OpenOffice in my system. So I'm not using
that. I do have pages. The only reason why I say no to pages is because it doesn't
display in the browser. I have to download the file. So but I do have pages and
other programs, so I like that Microsoft Word displays right in the browser and I
can just glance and grade it. OK, you've made my life easy by throwing this within
the by having the instructions in here and throwing everything together in the
manner that I just showed you. Uh, you will uh you'd be fine. Now let me show you
how to upload it. Let me go into, uh, here, uh, let me go to student view. OK, um,
so you can see what I see. I'll see what you see. So let's go into the, uh.
And then what you do is you choose the file, go to. Desktop.
If you want to give me a comment, you can, and that's fine. Now, if you want to do
this in Dropbox or Google Drive, that's totally fine. But I find that users run
into a permissions issue. If you do those things, remember that you have to give me
permission to access your drive, otherwise I can't grade it. So this is just the
easier way of dealing with it. OK, and then you say submit assignment and then
submit and then I get notice and then you get this wonderful thing, yay, you
submitted it and it will give your time. OK, now and then you can, you can download
it and you look at the submission details and then I create it and then your score
and your comments to me will appear here and I'll give you a comment. Whenever I
give you a comment, I always give you a reason. If I can't give you a full grade, a
full 50 points, I'll give you a reason why, OK? And so those reasons will be in the
comments. I'm usually very accurate as to so many points for this error and all of
this. So if for some reason, if I guess if I'm busy and I don't do that, you feel
free to ask is fine. If you don't understand why you lost points, I'd rather you
known us to have a conversation about it. OK, and if if I don't give you a comment
and you've lost points, it's it is possible that I typed in the wrong number. So
please do me a favor and just verify it with me. There's forty five of you and only
one of me. So sometimes I, I don't make mistakes often, but you know, I'm human and
sometimes I just do because I'm a human being. OK, so, so without further ado, this
is how this is the end of how to submit a lab assignment to me and you. I'll see
you in another video wherein I will lecture on chapter one, the topics of Chapter
one.