General assignment hints

  1. Start as earlier as possible. Even in the case of A5 where we haven't yet gotten to how lists are implemented in Pascal (i.e., one-dimensional arrays) you can still work on breaking down the assignment and work on it in parts. If you wait until next week before you even start the assignment, then you will have a great deal of difficulty completing everything (or you may even have a great deal of difficult completing anything).  One example of how you might break things down by creating multiple versions of your assignment is shown below.
  2. Break the problem down into parts.  Work on each part separately, test each part to make sure that it's working properly before adding it to the main program and moving onto the next part.  That way if you have a logic error in your program you can likely isolate it to the newest part that you are working on.   If you don't do this trying to find a bug in a program that is several hundred lines long can be extremely difficult.
  3. Do attempt all assignments.  As I mentioned in the very first lecture, Computer Science is a very hands-on discipline, you gain the deepest understanding of concepts by trying things out for yourself: write, trace and debug as much code as you can.  (In a similar fashion to working out you won't get a lot of benefit by just watching me do stuff, you have to go out and do things on your own as well).  Even if you only partially complete an assignment that may give you enough of an understanding of some of the concepts to get through your exam.  Or conversely if you get a zero on an assignment because you didn't do it you will likely get a zero on any final exam questions dealing with the same topic and remember that the final exam will include short answer questions such as code writing and code traces.
  4. Back up your work!  Once you get your basic program working make a backup copy (e.g., at Unix type 'cp StarTrek.p StarTrek.June9'.  As you complete additional features backup these versions and don't touch the backup!   When you start working on more features, modify only the copy.
  5.  If you don't understand something even after you went to class then ask for help!   This seems quite obvious but every semester I get students who don't really understand particular topics but never ask questions, skip most of the assignments and end up failing the exam.  I won't think that it's stupid to ask for help if you are actually doing the work for this class (such as going to lecture and trying the assignments) but just can figure something out.  (What I think is not so smart is to not ask for help when you need it).   Remember even though I've been teaching here for almost 4 years I actually started as an undergraduate student sometime at the end of the previous decade1 so I can still clearly recall that I had to work at things as well where I had ask for help like y'all!
  6. Don't fall behind.  Again I mentioned this during the first lecture but it is very important so I am reminding you again.  Because the programming concepts are cumulative and build so much on previous concepts if you fall behind then it is highly unlikely that you will ever be able to make up the time.

 

How to make multiple versions of your fifth assignment:

Version 1: Learning about the basics of modular design (functions and procedures). Since I've outlined in the assignment description the specific functions and procedures that you must implement you won't have spend a great of time planning out how to break things down but you do have to get very familiar with the details of how to define and execute the code for these modules.   Your first version could simply be a "skeleton" of all the modules in your program, meaning that all your functions and procedures will be listed but there will be statements in the body of each module save for some output messages so you know when a particular module is being run.  You can implement the code for the modules in successive versions, the idea for the first version is to determine EXACTLY what you need to create a compilable program that uses and calls functions and procedures.   Also for this version I would write modules that take no parameters because you can always rewrite your function and procedure definitions later.  The first version of your program could look something like this.

Once you have a compilable and working version back it up and DO NOT touch the backup.   Only make your modifications on the copy so that you will always have at least a partially working version if disaster strikes and you have insurmountable logic errors in later versions that you just can't figure out before the assignment deadline.

Version 2: Learning about parameter passing.  You can write your solution as a simpler version of the assignment, e.g., it tracks the employee of only one employee, it's admittedly a useless program but it's purpose is not for you to commercialize and sell the code but to teach yourself the more advanced concepts of modular design such as parameter passing.  In this version you'll likely only implement three modules: a) One to initialize the employee's salary to a starting value b) One to allow the user to input a value for the employee's salary 3) One to display the salary onscreen.   With this version of the program, instead of declaring an array of salaries for multiple employees (as described in the assignment) you should declare only a single real number variable in the main procedure and learn how to pass it as a both a value and variable parameter.  The second version of your program could look like this.

Again: Once you have a compilable and working version back it up and DO NOT touch the backup.

Version 3: Implementing some of the required functionality of the assignment program without using an array.  In this version of your program you can actually try to implement some of the code for the remaining functions and procedures.  You can do this by declaring three variables that are real numbers and passing these variables into each module as I do in this partial example (since we are now talking about how to write the code that you actually have to write for your assignment you didn't expect me to show you all the answers did you? )  This will allow to work figure the logic of some assignment even before you learn about the syntax of how to use an array.   Once you get this version working it should be a fairly easy to replace the three real variables with a single array of real number elements and to make a few slight changes to your modules so that they manipulate a single array rather than three separate variables.  Note: This version (which uses multiple declarations of real variables) is NOT the way you should implement your final version.   However doing it in this incorrect way first will give you a much better appreciation for why arrays are so useful...

1 In case skeptical about how true my statements are because you have worked out a few numbers and are wondering how I ended from starting out as a first year student to graduate student to full time faculty member so quickly, I finished my undergrad degree in a little over two years and was hired to work full time while I was still a full-time grad student.