CPSC 110-08: Computing on Mobile Phones
Spring 2012

Creating a Converter App

CS Principles

This activity addresses the concept of abstraction, focusing on functions and parameters (or arguments). It introduces functions as re-usable programming abstractions and shows how parametrization can be used to generalize a specific solution. It addresses the following learning objectives.

Fahrenheit to Celsius Conversion

This activity builds on the functions homework assignment, in which you developed a pseudocode algorithm for a fahrToCelsius functions and then translated it into App Inventor blocks. Your solution should look something like this:
# Comment: A function to convert celsius to fahrenheit
# Arguments:  C, represents the temperature in celsius

To celsiusToFahrenheit(C):
   Return: 9.0 / 5.0 × C + 32
(Click to enlarge.)

Inclass/Homework Exercises
Solutions

Identify a conversion function that you are interested in and write an app that performs that conversion. For example,

It's up to you to choose a conversion that you would find truly useful.

  1. Write a Pseudocode function for your conversion. Have you pseudocode checked by the instructor or TA.

  2. Convert your Pseudocode into an App Inventor function. Use the blocks editor to test that it is correct.

  3. Design and implement a simple app that peforms that conversion.
    You app should have a simple interface. For example, your app could use a simple Input-Process-Output design, similar to the Leap Year app. It could have 1 or 2 TextBoxes where the user can enter the value(s) needed as the input to the function, a Button that is clicked to perform the conversion, and a Label to display the result. You could copy and adapt the Leap Year app for this purpose.

  4. Describe your conversion algorithm and your app on a Portfolio page.

Homework

Finish for homework whatever you don't complete in class.