Lecture 3. MAE 5

Quiz 2 Today! (see version given previously). Another quiz given previously is here.

The homework from Chapter 2 is due in your section this week using the dropbox folder to submit your homework folder (example: A02-HW1 Doe, Sally) containing MEX 2 modified example programs and practice programs PP2.1,2,3,4,5. Once you are in the MAE5 folder you will see 1. Catlin's book files, including the Example Programs that you first run and then modify to make "MEX" programs for your homework as described in lecture 2. True BASIC Bronze application 3. TB Ref program 4. True BASIC for home using Macs and PCs (you may wish to do most of your work in the laboratory at first) 5. The DropBox folder where you submit your homework files.

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,2,4,5. It is a good idea for you to 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 Projects. 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. Read ahead and work ahead!

Before or during your Section Meeting this week, you must turn in your first homework folder (labeled A02-HW1 Doe, Sally for example) by dropping the folder (containing MEX2-1, MEX2-2, etc., PP2.1, PP2.1 etc.) into the Drop Box folder. Ask the TA in section how to do this. The belted flold appears by logging on as MAE 5-Gibson with no password in the ACSLAB... ACS-LAB-SERVER...Continuing Classes...MAE5 folder using the AppleShare network (select Chooser under the Apple). This is a one-way operation for students, but the TAs and I can open the folder to see who has turned in their homework. As you saw in the lecture, a series of mysterious statements appear when you try to submit your homework. You can't submit anything to the dropbox if you log in as a Guest. Watch for the copying bar as evidence that your folder of homework files was indeed copied into the dropbox folder. 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. Include a header with each of your MEX and PP files (name,section,CODEWORD). HW1 is due this week. Students using PCs at home can copy the True BASIC Bronze PC version and follow directions for converting to Mac format before turning in your homework. The converted PC file is a text file that you simply copy and paste to produce a Mac True BASIC program file. Test and submit these (Don't submit text files please. Pak suggests it is easiest for you to just work in the lab at first, and that you'll have time to do your homework in section).

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-HW1 Doe, Sally for our fictitious student Sally Doe in section A02) and copy in all the example programs from Chapter 2 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.

Projects: 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 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 MAE 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 two projects, which are True Basic programs of your own creation. Try to come up with programs that show off your programming skills as you apply them to solve interesting problems you have now, or might encounter in your future work, or just use for fun. Game programs are allowed. Viruses are not. Have lots of remark statements at the beginning to show the purpose and operation of your project programs. 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 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. Be prepared for Quiz 2 by reading Chapter 3 carefully before class, testing yourself with the self test questions and answers, plus Quiz 2 from Winter 1999 given here.

 

Lecture 4. MAE 5

Quiz 3 Today! (see version given before). A Quiz 3 previously given is here.

In your preparation for Quiz 3, go over the self test questions for Chapter 3 carefully to be sure you understand all the answers. Quiz 3a from Winter 1999 is given here.

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, with or without quotes. Naturally, if you type a number and attempt to use StringVariableHere$ as 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 as one of your projects. Such programs can be posted by the TAs in the laboratory for review by the rest of the class. For fun, try fancy calculations such as the force of gravity on the surface of the Earth, calculate the Planck length, mass, time and temperature scales that describe conditions at the time of the Big Bang, or concoct music programs such as "Old Smokey".

Solve as many additional Practice Programs as possible, and experiment with debugging techniques. You can get started by copying (select, xC) and pasting (xV) the solution for Practice Program 4.3 on p112 of the text. Another programming example that was shown in class is Practice Program 5.2 from p145 (this is one of your homework problems). Control C (xC) means holding down the apple key while hitting the c key.

Advanced concepts: Try this mat plot demo program. Write a sequential text file.

Help