Pseudocode Demonstrations for CMIS 102
|
Loading and Starting the Program:
To run the demo program, you download it to your computer and run it like any other Java application. Click here to download PsCodeSimApplet.jar. If your system blocks downloading of .jar files, you can Click here to download PsCodeSimApplet.raj, and then change the extension from .raj to .jar.
General Instructions:
Click the button in the upper left corner of the demo manager to select a demo from the drop-down list.
Click Initialize to set up the demo.
Click Step to execute one line of pseudocode at at time, or
Click Run to execute one line per second.
If you are in Run mode, you can stop executing lines by clicking Stop.
Anytime that you are not in Run mode, you can re-initialize the current demo, or select a different demo.
Tips:
- At any time, the highlighted line of pseudocode is the line that will be executed next.
- The current values of each variable are shown in the upper right pane.
- The most recently changed variable is highlighted in pink. Watch how the values change as statements are executed!
- You can resize the program window, and move the pane dividers, to your taste.
The following demonstrations are currently available:
- Integer Arithmetic Demo - does arithmetic with integer variables, and shows you what can go wrong. See Screen Shot!
- Integer vs. Float - illustrates an important difference between integer and float variables. See Screen Shot!
- Fibonacci - uses a very simple pre-test loop to print the Fibonacci numbers up to about 1000. See Screen Shot!
- Counter Controlled Loop - illustrates how a "For" loop works.
See the flowchart! See Screen Shot!
- Input Validation A - uses a pre-test loop to perform basic input validation. The user is asked to enter a number. If the data entered is not a number, the user is informed of the error, and told to try again. See the flowchart! See Screen Shot!
- Input Validation B - uses a pre-test loop to perform input validation that is a bit more involved. The user is asked to enter a positive number, not just any number. See Screen Shot!
- Function Example A - a simple use of a function. It uses a "larger" function to find the largest of three numbers. See Screen Shot!
- Function Example B - a more complex use of a function. It computes the roof area of a simple house given the critical dimensions. Click here to read about the problem and the approach to solving it. See Screen Shot!
- Array Example A - shows how counter-controlled ("FOR") loops can be used to manage arrays. The program finds the biggest number in a list of numbers entered by the user. The numbers entered are stored in an array, then the array is searched. See Screen Shot!
- Array Example B - a telephone directory application, using loops and two arrays. Click here for an explanation of this demo, and discussion topics. See Screen Shot!
- Reference-Parameter Subprogram Example A - uses a Swap subprogram with two call-by-reference parameters to sort an array of three numbers. In call-by reference, the formal parameters are not separate variables, but are aliases for variables in the client. Note how the ALIAS markings in the variable table change each time Swap is called. See Screen Shot!
- Reference-Parameter Subprogram Example B - fills an existing array with values, given a start value and an increment (like Fill in Excel). Click here for some discussion of this example. See Screen Shot!
Please send any comments or suggestions to Jack.
Last updated 21 January 2015 Revision History
Acknowledgements: Thanks to Prof. Nicholas Duchon and various students for many helpful suggestions.