The Finch is applying for a job as a weatherman. Give your Finch the ability to talk about the weather by creating a program that:
- Accepts a location as an input from the user.
- Creates a WeatherReader object using this location (don't forget to import the correct RSS reader!).
- Extracts the current temperature of the input location.
- Has the Finch interpret this temperature by commenting on it and by setting the color of its LED. For example, if the temperature is 30 or below, you might turn the LED blue and have the Finch say “It's crazy cold out, time to head south.” The Finch should say something different and have a different LED color for temperatures 30 and below, between 30 and up to 50, between 50 and up to 70, between 70 and up to 90, and over 90.
- The Finch should always say the temperature, but it's up to you what else the Finch says or how you light up the LED. They just need to be different!
- Take a look at the javadoc for the RSSReaders, specifically the weather reader. Note that it is constructed with a string, and that the getTemperature() method is crucial here.
- Add a sleep of at least 10 seconds to the end of your program. If your program calls saySomething() and then immediately calls quit(), you will only hear a fraction of a second of speech. Use sleep() to give your Finch time to say whatever it needs to say.
- Your computer must be on the internet for this program to work.
Here's some typically cold, hot, and moderate cities for testing your program:
- Barrow, AK
- Fargo, ND
- Phoenix, AZ
- Las Vegas, NV
- Death Valley, CA
- San Francisco, CA