Lecture 3. AMES 5, Tues. 12 Jan. 1999

From the course outline we see the reading assignment this week is Chapter 3 on Assigning Values to Variables, and you will be working on modified versions of all the example programs in this chapter (ie.: MEX3 means MEX3-1, MEX3-2, etc.), and you must do Practice Programs 3.1 and 3.2. It is lots more fun if you work as far ahead as you can, pulling out new commands from the advanced chapters which you can use to dress up your modified programs (MEXs) and Practice Programs (PPs), and start working into your Final Project. Surf the True Basic website for ideas about what you could consider for a project. Run the Demo Programs in the True Basic folder to see how more advanced coding works, and to find where you can read about it in the textbook. Make modifications to the Demo programs to see their effects on the program operation. Learn to run the Do Trace debugging programs described in Chapter 6. This is illustrated in TB Ref. Read ahead and work ahead.

Before or during your next Section Meeting, you must turn in your first homework folder (labeled A02-HW1 Doe, Sally for example) by dropping the folder (containing your CODEWORD file, MEX2-1, MEX2-2, etc., PP2.1, PP2.1) into the AMES 5 Drop Box folder that appears when you click on the hard disk icons of the computers in the AMES 5 laboratory. This is a one-way operation for students, but TAs and I can open the folder to see who has turned in their homework, and so the TAs can grade it. As you saw in the last lecture, a series of mysterious statements appear when you try to submit your homework. Do not be discouraged, but agree to everything if you are sure your homework set is correct, and the folder will be copied into the drop folder. The warning messages are telling you you won't be able to open the drop folder to retrieve your homework once you submit it. Watch for the copying bar as evidence that it made it. If you discover later that you made an error you want to correct, you can submit a revised homework folder (eg.: A02-HW1 Doe, Sally). It will not overwrite the original folder and files, even if they have the same names, so you should change the name so your TA will know to trash the original (eg.: Revision.A02-HW1 Doe, Sally [!trash original please!]). Be sure to have backup copies of your homework on your homework disk and elsewhere.

The easy way to do your homework is to first create a new homework folder on your homework disk (this week it would be labeled A02-HW2 Doe, Sally for our fictitious student Sally Doe in section A02) and copy in all the example programs from Chapter 3 from the Catlin disk. Then go through the example programs one by one, reading the material from the textbook to see what points the programs illustrate, running the programs to see how they work. Then save the program to a modified program file (MEX3-1 SD, for example) and make modifications and remarks as you change it to be sure you know what points it is supposed to illustrate. Catlin Example Program 3-5 is intended to illustrate exponentiation. After modification MEX3-5 might be very different. When you finish with the modified programs, then "unsave" the originals before you turn in your homework folder.

Final Project: As mentioned previously, it is a good idea for you to read ahead and do as many homework sets in advance as possible. You should also be using the hypercard stack TB Ref regularly to get advice about good True Basic programming procedures, and to run the illustrative programs included. Just open the stack (it's on the AMES 5 laboratory machines...use the finder to find it) and follow directions. Copy it from the laboratory machines or from Prof. Herz' homepage to use on your home Mac (it won't work on IBM clones) or in the campus MacLabs. As your skills progress beyond the reading assignments you can test them by working on your final project, which is a True Basic program of your own creation. Try to come up with a program that shows off your programming skills as you apply them to solve an interesting problem you have or might encounter in your future work, or perhaps just use for fun. Game programs are allowed for final projects. Have lots of remark statements at the beginning to show the purpose and operation of your final project program. Include remarks in the body to show the TA that you know what you are doing, and to remind yourself when you read it later. When you have a final project program ready to show off, let me know, and if there is time I'll run it in class.

At the end of Chapter 3 you should read the Summary of Important Points, Common Errors, Self-Test Questions, and work as many of the unassigned Practice Programs as you can. See PP3.3 for example.


Lecture 4. AMES 5, Thurs. , Jan. 14, 1999

Input statements:

The INPUT statement can be used to read in data from the keyboard in the form:

INPUT var1, var2, ...

where the variables can be either numeric or string. For example, you could input the first names and ages of your best friends with the statement:

INPUT name1$, age1, name2$, age2, ...

as long as you remember to have just the right number of best friends and don't forget to include all ages, separated by commas. Such True Basic statements are best tested by experimenting with the statement in a program.

If you want to input a string variable value that includes a comma, you need the LINE INPUT statement:

LINE INPUT prompt "Type in your prompt here ...": StringVariableHere$

and the StringVariableHere$ that you type in after the prompt can contain whatever you like, even without quotes. If you attempt to use a numeric variable you get an error.

The DATA statement permits storage of string and numeric values in memory for use in a program. The values are stored first, and in order from top to bottom, just like a sequential file, so if you reverse the order of your data statements you affect where the values are stored. Experiment with DATA and READ statements to be sure how they work.

New concepts in Chapter 3:

Many new programming concepts and True Basic statements are introduced in Chapter 3. You can best learn these by reading the material in the text as you modify the Example Programs for your homework. These concepts include:

All of these topics are illustrated by Example Programs.

You might consider making up self-test programs as a means of study for the quizzes, or even as your Final Project. If you do this early and well, such programs could be posted in the laboratory for review by the rest of the class. Try calculations such as the force of gravity on the surface of the Earth.

Solve as many additional Practice Programs as possible, and experiment with debugging techniques. You can get started by copying (select, ^C) and pasting (^V) the solution for Practice Program 4.3 on p112 of the text. Another programmng example that was shown in class is Practice Program 5.2 from p145 (this is one of your homework problems).