mrbrenlea

mrbrenlea

Monday, September 28, 2015

Variables

For our chapter this week, we explored how we can use variables in our programming to give greater flexibility to what our programs can do.  Variables allow bits of information to change while the program is running or when it is run by different people.  For example, if you have a math problem with x and y, you can program the application to ask the user to input x and y each time the program is run so that different answers appear.  Variables can also be used to help program a score screen on a game.

At the end of the unit, I decided to work on two different problems and explored how I could use variables within them.  For the first problem, I created a program that calculated the distance travelled based upon speed.  I decided to use the slider option for this program.  While I am happy with it and the modifications that I made, I quickly discovered that the slide does not appear to allow decimal.  This is problematic for certain problems.  If I were doing it again, program it to allow decimals.



For the second project, I decided to explore math problems a bit more.  I took the second problem and decided to allow greater flexibility.  Instead of me deciding the numeric value, I decided to ask the user to input different values for the variables.  By using the ask and wait feature, I was able to prompt the users to input different numeric values. After I completed the project, I realized I wasn't happy with how the speaking look.  I decided to go back and alter it using the join feature.  I've included both programs below.

No comments:

Post a Comment