Lecture 17. AMES 5, Monday 2 Nov. 1998

From the course outline we see the reading assignment this week is Chapter 7 on Writing Programs Using Procedures. You need to turn in modified versions of all the example programs in this chapter, and do Practice Programs 7.1 and 7.2. This is the first chapter in Part 2 Advanced Programming Techniques, and introduces the use of external functions and subroutines as well as libraries and modules. These are all methods to break a complex computer program into smaller, more easily understood pieces.

Some of the methods presented include:

All of these concepts are illustrated by the Example Programs which you will modify in your homework.

Practice Program 7.3 requires that you write an external function program Pred$ to return the predecessor in the ASCII table of a character parameter. Test the function for the strings "C", "A", "@", and "qed".

As part of the preliminary testing of the parts of the program, it was useful to write an auxilliary Practice Program 7.3.1. In this program, the "ord(A$)" function is tested.

 

Lecture 18. AMES 5, Wed. 4 Nov. 1998

Practice Program 7.6 uses an external function to cube a numerical parameter.

Practice Program 7.8.1 to fill the screen with dots (not using a subroutine).

Practice Program 7.8 to fill the screen with dots using a subroutine to draw the lines.

Practice Program 7.12 uses an external function to compare strings for equality.

 

 

Lecture 19. AMES 5, Friday, 6 Nov. 1998

Use the Modified Example Programs to practice your True Basic programming skills. Show that you understand the purpose of the example program in your modification, both by comment statements and by your changes. Try to make it easy for the user (your TA) to see what you have done rapidly. Thus, it is a good idea to have your data entered automatically in a do loop reading from a data statement rather than from an input prompt statement. You can show you know both methods by commenting out the other method, and noting that you are doing so. You can put in sound and color at critical points of calculations to assist in your demonstration and debugging. MEX7.3 to calculate a factorial function demonstrates some of these points. A factorial such as 4! means 1x2x3x4. This is calculated in an external function with name "Factorial". There is no meaning to a calculation of a negative number or a non-integer number, so the program traps these errors and gives the user another chance to enter a valid number. In your modified programs, assume the TA will simply run the program first before looking at it to see what it does, and then if the output is interesting he/she will look more carefully to see how you did it.

The same strategy applies to your final project. You should pick as your project something that interests you, and will be recognized as useful by the user (TA!). An obvious project that will please everyone is a FlashCard program for True Basic, as I suggested in lecture. You could write a program that displays Self Test Questions from the textbook for the Chapters we have covered, and then provides correct answers, and perhaps a grade that accumulates as the user works through the questions.

Help