TouchDevelop is a unique programming environment because it allows you to develop software on a Windows Phone 7 or Windows Phone 8 smartphone. You can also develop on any web platform using the TouchDevelop web app.
Download software: Windows Phone 7 or 8: download from the Windows Marketplace or Store app on your phone. Access the web development environment at http://www.touchdevelop.com.
Instructions to setup software: Will install automatically on a Windows Phone or just run the web app from any PC internet browser. (Yes, even Safari on a Mac.) You will need a Microsoft Account to fully use this tool. Windows Phone users already have a Microsoft Account.
TRY IT! (Instructions for http://www.touchdevelop.com)
1. Open the TouchDevelop web site and log in with your Microsoft account. Once you log in, the web page will look something like this.
2. There are lots of help files and tutorials right on the web page. They are a great resource as you learn to create programs with this system.
3. To create a new script, click on the Create Script tile. You’ll be brought to this screen:
4. Select the blank app. Type the name ‘BSA Temperature Converter’ into the dialog that appears and click create. You see this screen appear.
5. Now you are ready to create the code for your app.
6. Click on the word ‘main’ in the code editor. A list of options will appear on the left hand side.
7. Click on the ‘add input parameter’ plus sign to create your temperature input. A parameter ‘P: Number’ will appear between the parentheses be the word main. Click on the P and you can change the name.
8. Now that you’ve created the variable that you’ll use to enter the temperature, it’s time to create the constants and equation to calculate the Celsius temperature. To start, click in the do section where it says ‘do nothing.’
9. A virtual keypad will come up with options that you can add to the program that you are writing.
10. To create your variables click on the var button and create the variable ‘Factor’. Set it equal to 5/9. Click on the plus sign in the circle just below the variable that you just created and create another variable ‘Constant’ and set that equal to 32.
11. Then create a third variable Celsius. Use the keypad options to set Celsius equal to (Factor * Degrees Fahrenheit) – Constant
12. This is the core of the program. It will now calculate the temperature in Celsius when given the temperature in Degrees Fahrenheit. Continue using the editor to create the rest of the program.
13. To create the response lines, create a new line like you have before. Then click on the left parentheses, type a double quotation mark and enter your text. Then click on the button with the two vertical lines, ‘||’, add the Celsius variable, then click on the ‘||’ button again and add the rest of the text.
When you run the program in a web browser, it will look like this.
The arrow button returns to the TouchDevelop web page and the button at the top on the right resets the program so that you can try several conversions without having to restart the program. Enter a temperature and click the OK Button to see the result. Try several different temperatures.
ABOUT THE PROGRAM — A WALK THROUGH
1. The action main() function
a. Obtains the value entered in the Input Textbox.
b. The value is converted to Celsius (with a single decimal place).
c. The Celsius value is evaluated with a series of IF Statements and a suggested action phrase is posted to the display area which is called the wall.
d. A sentence is created by combining or “concatenating” some static text along with the temperature values (deg F and Deg C) and the action phrase.
1. Change the temperatures used in the decisions – change the lower temperature from 60 to 30 degrees, for example. Save the file, restart the program, and enter new numbers – did the answers change at the new temperature?
2. Create a new temperature range from 30 to 60 degrees and have it display – “Bring hat and gloves!”
3. Change the wording of the phrases
4. Add another text input – ask for the wind speed, for example
5. Add some conditional statements that evaluate the wind chill factor
6. Add some text to display the wind chill result
http://www.touchdevelop.com has tutorials and help files to help you learn this language.
Inspire Leadership, Foster Values: Donate to Scouting
When you give to Scouting, you are making it possible for young people to have extraordinary opportunities that will allow them to embrace their true potential and become the remarkable individuals they are destined to be.Donate Today