Lesson 15
Part II (Introduction to Programming, continued)
In this part, we will ask the user for input and then display a message using their input.
1. Getting Input from the User

2. More Input from User

What is the difference between Input and InputStr?
- InputStr treats what we input as a string. In programming we call text strings (text is made up of a string of characters).
- Input treats what we input as a value that we can perform calculations on.
3. Viewing a Variable's Contents
4. Viewing a Variable's Contents (Continued)

How do we average numbers?
In the Part II practice exercises you will write a program to find the average of three grades. Remember, to find an average, we add the values and then divide by the number of values we added. For example, to average 80, 92 and 88 we find (80+92+88)/3.
In general, to average grades a, b and c we find (a+b+c)/3.
Part II
Practice Exercises
- Begin a new program named Average by clicking
and inputting the program name. - Input code to display the message Averaging Test Scores in the upper left corner of the display window. Remember to input the line of code needed to first clear the window.
- Run your program to make sure it works.
- Ask the user to input their first test score by adding this line to your program: Input a,”1st Test Score”. This will store the user’s first test score in the variable a.
- Run your program to make sure it works. With the input dialog showing, get a screen capture. Paste it into your Lesson15 document (under a title of PART II).
- Add two more lines of code to prompt the user for their 2nd and 3rd test scores. Store the 2nd test score in variable b and the 3rd in variable c. [Hint: select Input a,”1st Test Score”, copy it (Ctrl+c), paste it (Ctrl+v) twice and then change the a and 1st.]
- Run your program to make sure it works.
- With your program showing, get a screen capture. Add two blank spaces following the first screen capture and then paste this one.
- Now we need to average the user’s test scores. Input code to display the message Your test average is:
- Add code to display their average by typing in Print (a+b+c)/3.
- Run your program and input 90, 78 and 98 for the test scores.
- Change Print (a+b+c)/3 to Print approx((a+b+c)/3).
- Run your program again.
- With the average showing, get a screen capture of your output window. Add two blank spaces following the second screen capture and then paste this one.