Download presentation
Presentation is loading. Please wait.
Published byElijah Carter Modified over 9 years ago
1
Computer Programming 12 Mr. Jean May 8 th, 2013
2
The plan: Video clip of the day Upcoming Assessment Bot.java
3
Java Quiz #2: Questions about –Types of variables Int, double, spring –Basic Math operations + - * / % –Order of operations in Java –True Tables
4
Quiz #2 - Format Multiple Choice –15 questions Date: May 13 th, 2013
5
Loops refresher: Recall the usage of for loops. We define a for loop with three parts: the initializer, the tester and the increment. Here is an example of a for loop that would run 10 times: for (int i = 1; i <= 10; i++) This loop will begin with i equal to 1 and will continue until i equals 11. This means that it will run when i equals 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10.
6
The Bot class: We will now use loops to make the Bot draw. As stated in section 3.4 of the textbook, the Bot class is a simulation of a drawing robot. You can give this robot commands and he will perform them on the screen for you.
7
Possible Bot Commands:
8
Using the Bot Class: You can use the Bot class in your program as long as you have the file Bot.java in the same directory as your program. You can find Bot.java on the G: drive in the course pass-out folder. Copy it to the directory of your program’s java file. There’s no need for an import statement.
10
This program loops four times. On each iteration of the loop, the robot draws a line of length 100 and then rotates 90 degrees. You can easily see how this would draw the four sides of a square.
11
To do: Complete Java Assignment #3 Work on Drawing LAB which is posted in our Moodle account.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.