This Finch is a small robot designed for students learning computer science. You can write programs to move and turn the Finch, light up its beak, and collect information with its sensors. As you write programs, you will be able to test your programs with the Finch in the real world!
Lesson 1 – Speaking with the Finch
Required Java Concepts
Creating and running a program, Declaring a variable, Printing text to the screen, Accepting user input and storing it in a variable
The very first thing you will do with the Finch is to make it talk! First, create a new Finch file. You should copy FinchTemplateFile.java, give it a new name, and add it to the your Finch project or workspace. The details of how you do this will vary slightly based on the Java environment that you are using. Do not create a new project or workspace. If you do this, the libraries that the Finch uses will not be configured correctly.
To make the Finch do different things, you will use different commands called methods. You will start with two commands: saySomething() and sleep(). First, try out the example shown below. You will only need to put in the commands that are outlined. All of the other code is already in your file.
Notice that every Finch command must be used after the name myFinch and a period (myFinch.). This tells the computer that you are using a Finch command.
You need to use a sleep() command every time you use a saySomething() command. The sleep() command gives the computer time to play the string. Otherwise, the program may end before the computer has finished playing it. If you want the computer to say something long, you will need to increase the time that the sleep() command pauses the program.
Make the Finch say a string with at least 15 words. How do you need to change the sleep() command to give the program enough time to say all of the words?
Instead of placing an integer inside the parentheses of the sleep() command, you can use an integer variable instead. Declare an integer variable that holds a number of milliseconds. Then use that variable in the sleep() command.
Instead of placing a string inside the parentheses of the saySomething() command, you can use a String variable instead. Write a program that asks the user to enter what the Finch should say and then makes the Finch say it.
Write a program that asks the user their name and then has the Finch greet them by name.