Getting Started: Edit the program to do the conversion

2.3a-EditProgramTo get to the edit screen, you can either tap the EDIT button at the bottom of the About this program screen, or you can tap the BACK ARROW button to get back to the Programs list and then tap the program’s EDIT button.

The program starts out with a sort of mini-sample.  You’ll be deleting the mini-sample code and replacing it with your own.

Most conversion programs follow the same pattern:

  1. Get a number from the calculator display.  This is the number of square feet.
  2. Multiple or divide it to get the new value.  To convert square feet to acres, just divide by 43560.
  3. Output a string to the calculator display to say what we’ve done.
  4. Return the numeric value so it’s set into the calculator

The program to do these is:
value = Calculator.Value
newValue = value / 43560
Calculator.Message = “Converted ”+ value+ “ square feet to acres”
STOP newValue 

Each line corresponds to one of our steps.  Enter this code into the program area.

2.3a-EditProgramComplete

Next step: Run the program to test it!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s