## ← Relational Operators - Intro to Java Programming

• 2 Followers
• 16 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=dKMSnakREuU" data-team="udacity"></div> ``` 6 Languages

Showing Revision 5 created 05/24/2016 by Udacity Robot.

1. Here's how I figured it out. If I look at an arbitrary point, x and y, where as
2. always in our graphical coordinate systems, x grows this way and y grows this
3. way, downward. And it's clear that the x value here has nothing to do with
4. which color to chose. But the y value does, so I have to worry about the y
5. value being. Greater than or maybe greater equal, we'll come back to that in a
6. minute, then half the height. Now if it's greater than or greater than equal,
7. or less than or less than equal, it's easy if it would make these things wrong.
8. So, let's look at the actual numbers. Let's assume that the height is 200. In
9. that case the Y values can be from 0 to 199. So, if they're from 0 to 99 then I
10. want red. And if they're from 100 to 199 then I want white. So, if height is
11. 200 then height is over 2 is 100. Greater or equal than 100 should give me
12. wide. So, this is exactly the right condition, we'll put it in here and
13. otherwise I want Red. Let me put it in and demo it to you. I'll just make a
14. flag, many flags as I want in a half times as wide as they are tall and I'll
15. use the same here. And here it is. Red on top, white on the bottom. Let's move
16. on to a more complicated flag.