Required Java Skills: Creating and running a program; declaring a variable; printing text to the screen; accepting user input and storing it in a variable
Resources available for teachers. Get Access
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.