## Beginning Programming 3 - Section Four

### The Next Challenge

We have covered a lot of ground in this installment of the Beginner Series. For next time I am again issuing a challenge for you to work on. Developing programs on your own is a great way to expand and extend you skills.

What we want this time is a utility program that will take a value (either Celsius or Fahrenheit ) and convert it to the other. Use the three Windows widgets PROMPT, NOTICE and CONFIRM exclusively for input and output. The formula that you will need to go between the two is as follows:

```Celsius to Fahrenheit: [Celsius degrees] x 9 / 5 + 32

Fahrenheit to Celsius: [Fahrenheit degrees] - 32 x 5 / 9
```

Also remember that the PROMPT command will not accept numeric variables as a parameter, you must use strings. Of course this poses a problem, as you can not do math on a string value. The work around is to get your numeric value into a string and then convert it to a numeric value, for the purpose of doing math, using the VAL function. Here is what the Liberty Basic Help file says about VAL:

VAL(stringExpression)

Description:

This function returns a numeric value for stringExpression is stringExpression represents a valid numeric value or if it starts out as one. If not, then zero is returned. This function lets your program take string input from the user and carefully analyze it before turning it into a numeric value if and when appropriate.

Usage:

print 2 * val("3.14") Produces: 6.28

print val("hello") Produces: 0

print val("3 blind mice") Produces: 3

By now you should also have realized something special about the Liberty Basic Help file. It is the first place to look for the correct usage of a command. I use it daily. If you wish to be a seasoned Liberty Basic programmer, I suggest you also make it your friend.

Next time we will be discussing the solution to the new challenge and examining arrays yet a little more, including two dimensional arrays. Till next time...

Until next time - Good bye.