UMBC CMSC 202, Computer Science II, Spring 1999, Sections 0101, 0102, 0103, 0104

Project 1 Notes


  1. To keep the simulation simple, I make the (unrealistic) assumption that it takes no time to remove a job from the print queue, and therefore we can remove the first three jobs instantaneously and simultaneously. You are free to make this assumption in your project. This means your simulation begins like this:

    If you prefer, you can do a little bit more work and do a better job of modeling what would happen in "real life." This means that your simulation would begin like this:

    The output will be then slightly different from what appears on the web page for Project 1. The output should be: Print Job #100 added to CMSC 202 Print Queue Print Job #101 added to CMSC 202 Print Queue Print Job #102 added to CMSC 202 Print Queue Print Job #103 added to CMSC 202 Print Queue Print Job #104 added to CMSC 202 Print Queue Print Job #105 added to CMSC 202 Print Queue Print Job #106 added to CMSC 202 Print Queue Print Job #107 added to CMSC 202 Print Queue Print Job #108 added to CMSC 202 Print Queue Print Job #109 added to CMSC 202 Print Queue Print Job #100 added to Printer #1 Print Job #101 added to Printer #2 Print Job #102 added to Printer #3 Print Job #101 finished (17 pages) Print Job #103 added to Printer #2 Print Job #102 finished (22 pages) Print Job #104 added to Printer #3 Print Job #104 finished (11 pages) Print Job #105 added to Printer #3 Print Job #100 finished (43 pages) Print Job #106 added to Printer #1 Print Job #106 finished (3 pages) Print Job #105 finished (10 pages) Print Job #107 added to Printer #1 Print Job #108 added to Printer #3 Print Job #108 finished (12 pages) Print Job #109 added to Printer #3 Print Job #107 finished (18 pages) Print Job #103 finished (54 pages) Print Job #109 finished (27 pages)

  2. Several students have observed that on page 71 of the textbook, there is a recommendation which states: "If a class has any constructors, provide a default constructor." A logical question, then, is: Should you add a default constructor to the PrintJob class?

    Answer: Generally speaking, it is a good idea for a class to provide a default constructor so that the user of the class has an easy way to create an object of the class without specifying any intializing values. The default constructor can provide appropriate default values to initialize the data members of the object, and can ensure that the object is initialized in a reasonable and valid state. It is also useful to have a default constructor in place when you want to create arrays of objects. Ocassionally there are classes for which a default constructor may not be appropriate, i.e., it doesn't make sense to create an object of the class without supplying specific values for one or more of the data members. For example, we probably wouldn't want to have a Person object without a name. For the purposes of this project, my intention was to keep the classes as simple as possible. As written, the classes for this project are not necessarily models of everything that should or could be in a class. Bottom line is: for this project, use the class bodies as provided. Don't add anything; don't remove anything.


Last Modified: 14 Feb 1999 14:37:03 EST by Alan Baumgarten, abaumg1@cs.umbc.edu

Back up to Spring 1999 CMSC 202 Section Homepage