00:02
Okay, this time they want us to come up with conditional expressions in order to perform tests.
00:15
So to perform test, and there's one for every part.
00:19
Let's see.
00:21
In part a, the test will be if the amount owed is greater than 1 ,000.
00:38
So if amount owed greater than 1 ,000, that's our condition, then display an overdue message.
00:45
So assuming we're using the system namespace, we'll have console.
00:50
Dot right line.
00:56
Let's see.
00:58
Right line.
01:03
Overdo balance.
01:08
Don't forget, we're going to need a semicolon at the end of that method call.
01:13
And now at c and b, they want us to, let's see, this time.
01:22
We have a variable amount of ring.
01:24
So let's see.
01:26
If our test amounts of rain, let's see, greater than 5 inches.
01:46
So remember this is assuming that both of the units are the same.
01:50
You'd have to convert this to inches.
01:52
So maybe you'd write a method for that if you needed to.
01:56
Just make sure you note that you're assuming this is an inch.
02:01
So if the amounts of rain is greater than 5, then we have a variable called total, and we're going to add five to it plus equals with a compound assignment operator five there we've incremented total by five let's see oh there's more okay when it is between three and five inches add three inches total so okay else if let's see amount of rain greater than or equal to three inches so three okay, why does this one work? well, this first case is mutually exclusive with the previous, and if you're bigger than five, you all will have already been caught here.
03:12
So you're either less than or equal to five.
03:15
So that's already true once you reach this test.
03:18
And so this is only run, this case.
03:20
One amount of rain is in the range from three to five.
03:25
Like that closed interval notation for math.
03:28
Yeah.
03:28
So if we're in this case, when we're between 3 and 5, they want us to add 3 to the total.
03:39
So total, compound operator assignment, increment by 3.
03:45
And then let's see.
03:47
Else when it's less than 3.
03:50
Well, we could just do else because that's the only case left, right? we already have all the other intervals are going to be from our minimum possible to, let's say, less than 3.
04:06
So on open.
04:08
I'll include the minimum less than three.
04:13
In this case, we're going to i only add one to the total.
04:19
So total plus equals one.
04:22
And if you want to write it with curly braces, please do so.
04:26
You're going to make a lot of employers and project partners and people who use your code very happy.
04:33
But this is perfectly legible in shorthand.
04:37
Now let's see.
04:39
We have another problem part see when middle initial is equal to the character z so if the variable let's see middle initial is equal to z they want us to display a message you're one in a thousand so let's see we're going to get our console assuming we're using our appropriate name space for system we're going to do the right line method right line what do they want us to say you're one in a million.
05:35
Let's write that.
05:38
You're one in...
05:41
Oh, a thousand.
05:42
Okay.
05:42
That's still pretty good.
05:43
One in a thousand...