## ← Your Turn to Do It by Hand - Intro to Java Programming

• 2 Followers
• 14 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=M9-1Va5hil4" data-team="udacity"></div> ``` 6 Languages

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

1. Now that you've seen the computation with specific values, let's do it in
2. general. So what did we do? We started with the width of the floor, subtracted
3. the size of the first white tile. Divide it by the sizes of the pairs, took the
4. integer part. And that gave us the number of pairs. Now that's of course the
5. same as the number of red tiles, because every pair has one red tile. And, the
6. white tile says one more. All right, now, we're ready to program, and what I'd
7. like you to do is to complete the program that we started for you. The program
8. will read as inputs, the width of the floor and the tile sizes. And your job
9. will be to run the computation that I've just developed, and to print the
10. answer. Here's the program for you to fill in. You already give the commands
11. for the input and for the output and your job was to put in the part of the
12. program that asked computation. Now we did this by hand, and let me show you
13. again the formula that we obtain. That's the formula here. So we take the width
14. minus the tile size divided by twice the tile size, take the integer part.