Advertisement
English transcript
Hey.
>> Hey. >> What's going on?
>> Just wait for it.
>> Okay. >> Okay.
So, you know how we have a variable called number of coffees
ordered in our app.
>> This box. Yeah.
>> And we had the value two in it.
>> Correct. >> If I hit the plus button
in the app now.
>> Beep >> Then
what is the number of cups of coffee we have?
>> Well, that would be, increment by one, so the new value should be three.
>> Yeah. So I'm going to
throw out this old value and put in this new one.
>> Okay. >> If I hit the plus button
again- >> Beep!
>> Then how many cups do I have?
>> Well now we will increment that to four.
>> Yep. >> So throw this out, add four in.
>> Okay. >> Now, if I hit the minus button-
>> Beep beep beep
>> Then how many cups of
coffee do I have?
>> But Catherine I thought you said there would be no math?
>> It's one.
Write that down.
Thanks. >> Okay.
Here it is.
One. >> Yep.
>> Let me give that to you.
>> Thank you.
Let's add all of this into our app now and
we're going to work on your math later Let's look at the pseudocode for how
clicking the plus button in the app can increase the number of coffees ordered.
Pseudocode is a high level description that explains
the steps of what the app will do.
We can write it out as if we're describing it to someone,
because it's meant for people to read, not computers.
This helps us put our thoughts into a linear flow of what needs to happen
one step after the next.
When writing pseudocode we don't have to follow any specific structure or
format, we just need to include useful details that would help us write
the code later on.
For our scenario, we want to create a quantity variable to keep track
of the number of coffees ordered and we initialized the value to two coffees.
If the plus button is pressed, we can update the quantity variable to three.
If we hit the plus button several more times
we can increase the quantity to four and five.
Once we have a conceptual idea in our head of what the code should do,
then we can focus on writing the actual Java code.
At this point then we can worry about the syntax of Java, the capitalization,
the symbols, the spacing and
other specific rules about how to write Java code.
The real code would look like this to create a quantity variable and
set it to two, we would have int quantity = 2 followed by a ;.
This is what we covered in the last video.
To update the quantity variable to 3 we just need to say quantity = 3 followed
by a semicolon.
If we update the quantity to 4 and 5, this is what the code would look like.
For this quiz I want you to practice typing out these lines of code
in the text fields provided.
This will give you practice in creating an integer variable and
updating it in Java.
Pay close attention to each character and symbol as you type this out.
When you're done, do you have any observations about the format of
the code that you just typed out?
For example, do you recognize any patterns?
Enter any observations in this text field here.
>> Hey. >> What's going on?
>> Just wait for it.
>> Okay. >> Okay.
So, you know how we have a variable called number of coffees
ordered in our app.
>> This box. Yeah.
>> And we had the value two in it.
>> Correct. >> If I hit the plus button
in the app now.
>> Beep >> Then
what is the number of cups of coffee we have?
>> Well, that would be, increment by one, so the new value should be three.
>> Yeah. So I'm going to
throw out this old value and put in this new one.
>> Okay. >> If I hit the plus button
again- >> Beep!
>> Then how many cups do I have?
>> Well now we will increment that to four.
>> Yep. >> So throw this out, add four in.
>> Okay. >> Now, if I hit the minus button-
>> Beep beep beep
>> Then how many cups of
coffee do I have?
>> But Catherine I thought you said there would be no math?
>> It's one.
Write that down.
Thanks. >> Okay.
Here it is.
One. >> Yep.
>> Let me give that to you.
>> Thank you.
Let's add all of this into our app now and
we're going to work on your math later Let's look at the pseudocode for how
clicking the plus button in the app can increase the number of coffees ordered.
Pseudocode is a high level description that explains
the steps of what the app will do.
We can write it out as if we're describing it to someone,
because it's meant for people to read, not computers.
This helps us put our thoughts into a linear flow of what needs to happen
one step after the next.
When writing pseudocode we don't have to follow any specific structure or
format, we just need to include useful details that would help us write
the code later on.
For our scenario, we want to create a quantity variable to keep track
of the number of coffees ordered and we initialized the value to two coffees.
If the plus button is pressed, we can update the quantity variable to three.
If we hit the plus button several more times
we can increase the quantity to four and five.
Once we have a conceptual idea in our head of what the code should do,
then we can focus on writing the actual Java code.
At this point then we can worry about the syntax of Java, the capitalization,
the symbols, the spacing and
other specific rules about how to write Java code.
The real code would look like this to create a quantity variable and
set it to two, we would have int quantity = 2 followed by a ;.
This is what we covered in the last video.
To update the quantity variable to 3 we just need to say quantity = 3 followed
by a semicolon.
If we update the quantity to 4 and 5, this is what the code would look like.
For this quiz I want you to practice typing out these lines of code
in the text fields provided.
This will give you practice in creating an integer variable and
updating it in Java.
Pay close attention to each character and symbol as you type this out.
When you're done, do you have any observations about the format of
the code that you just typed out?
For example, do you recognize any patterns?
Enter any observations in this text field here.