Course News

April 13, 1998


Final Exam
----------

The final exam covers all material presented during lectures, including
    - Functional Programming with Lisp;
    - Logic Programming with Prolog;
    - Object-Oriented Programming with Java
    - Programming Language Syntax
The course does NOT cover
    - Programming Language Semantics
    - The second half of the material on Logic (which relates the Prolog
    inference procedure to theorem 
	      proving in Logic)

The exam is 2hrs long, closed book and includes 4 questions having equal
weight:
	- Short questions  (FP, LP, OOP, syntax)
	- Lisp programming
	- Prolog programming
	- Java programming

Let me know if you have any questions -- John Mylopoulos
    

April 2, 1998


The Animals file
To be used to test your assignment 3 program.
--------------------------------------------

newAnimal penguin tweety country southAfrica dateOfDiscovery  21/05/83
wingSpan 80 eggSize 18 range 0 swimPerDay 600
newObservation tweety 17/03/85 kenya
newObservation tweety 31/12/91 uganda
deathReport tweety 27/02/92 
newAnimal penguin tommie country southAfrica dateOfDiscovery  21/10/93
wingSpan 83 eggSize 48 range 0 swimPerDay 900
newObservation tommie 27/07/95 southAfrica
newObservation tommie 29/12/97 southAfrica
newAnimal penguin peter country nigeria dateOfDiscovery  01/11/91 wingSpan 70
eggSize 48 hairColour black swimPerDay 400
newAnimal ostrich bigBird country  egypt dateOfDiscovery  14/11/87 wingSpan
256 eggSize 25 range 0
newObservation bigBird 03/11/88 egypt
newObservation bigBird 11/02/91 uganda
newObservation bigBird 13/07/95 southAfrica
deathReport bigBird 08/10/94
newAnimal albatross harry country mozambique dateOfDiscovery 04/11/97 wingSpan
122 eggSize 8 range 6000 fishPerDay 260
newAnimal albatross larrisa country senegal dateOfDiscovery 24/08/96 wingSpan
158 eggSize 16 range 12000 fishPerDay 240
newAnimal cheetah sue country libya dateOfDiscovery 30/12/91 hairColour tawny
milkProduction 0.4 meatPerDay 20 habitat trees
newAnimal cheetah mac country nigeria dateOfDiscovery 10/03/94 hairColour
tawny milkProduction 0.6 meatPerDay 25 habitat trees
newAnimal cheetah felix country southAfrica dateOfDiscovery 03/11/96
hairColour tawny milkProduction 1.2 meatPerDay 50 habitat trees
newAnimal tiger felicia country nigeria dateOfDiscovery 13/01/86 hairColour
yellow milkProduction 1.8 meatPerDay 5000
newAnimal tiger rose country algeria dateOfDiscovery 31/05/92 hairColour
yellow milkProduction 1.9 meatPerDay 3000
newAnimal girraffe longNeck country boswana dateOfDiscovery 17/08/94
hairColour yellow milkProduction 1.5 hoofSize 28 neckLength 187
newAnimal girraffe donald country mozambique dateOfDiscovery 12/11/97
hairColour black milkProduction 1.7 hoofSize 26 neckLength 192
newAnimal zebra blackStripes country uganda dateOfDiscovery 15/10/95
hairColour white milkProduction 1.2 hoofSize 22

March 25, 1998


Assignment 3: These are the definitions of the FileTokenizer and the
SimpleDate classes you need for the assignment.


import java.io.*;
import java.util.*;

public class FileTokenizer {

  private File f;

  public FileTokenizer(String filePath) throws FileNotFoundException {
    f = new File(filePath);
    if (!f.exists()) {
      String message = "\nConstructor for FileTokenizer found that:\nfile: "+
      filePath+" doesn't exist.";
      throw new FileNotFoundException(message);
    }
  }

  /** Returns an array of StringTokenizers: one for each line in the
   * file being read. Note that StringTokenizers get consumed when their
   * "nextToken()" or "nextElement()" methods are invoked. If a token needs
   * to be used twice, remember to store it in a variable.
   **/
  public StringTokenizer[] readAndGetTokens() 
    throws FileNotFoundException, IOException {
      BufferedReader r = null;
      r = new BufferedReader(new FileReader(f));
      String line;
      Vector temp = new Vector();
      while ((line = r.readLine()) != null) {
      temp.addElement(new StringTokenizer(line));
      }
      r.close();
      // Inefficient. Could have just returned an Enumeration.
      StringTokenizer[] result = new StringTokenizer[temp.size()];
      for(int i=0;i");
      System.exit(0);
    }
    try {
      FileTokenizer t = new FileTokenizer(argv[0]);
      StringTokenizer[] tokenizers = t.readAndGetTokens();
      for(int i=0;i 12 ) 
      throw new DateFormatException("month: "+month+" > 12");
    if (year < 0) 
      throw new DateFormatException("year: "+year+" < 0");
    if (year > 9999) 
      throw new DateFormatException("year: "+year+" > 9999");
    if (month == 9 || month == 4 || month == 06 || month == 11 && day > 30)
      throw new DateFormatException("day : "+day+" > 30 in month with 30
   * days");
    if (month == 2 && (year % 4 == 0) && day > 29)
      throw new DateFormatException("day : " + day + 
					     " > 29 in February in a leap
   * year");
    if (month == 2 && (year % 4 != 0) && day > 28)
      throw new DateFormatException("day : " + day + " > 28 in February");
    this.day = day;
    this.month = month;
    this.year = year;
  }

  /** Returns a value between 1 and 31, depending on the month. **/
  public int day() { return day; }

  /** Returns a value between 1 and 12. **/
  public int month() { return month; }

  /** Returns a value between 0 and 9999. **/
  public int year() { return year; }

  /** Returns true if the two represented dates are equal. Otherwise
   * returns false. 
   **/
  public boolean equals(Object obj) {
    if (!obj.getClass().getName().equals("SimpleDate"))
      return false;
    else {
      SimpleDate testDate = (SimpleDate) obj;
      return (day() == testDate.day() && month() == testDate.month() &&
            year() == testDate.year());
    }
  }

  /** Returns true if this date occurs before the testDate
   * parameter. Otherwise returns false.
   **/
  public boolean occursBefore(SimpleDate testDate) {
    return (year() < testDate.year() ||
        (year() == testDate.year() && month() < testDate.month()) ||
	    (year() == testDate.year() && month() == testDate.month() &&
	         day() < testDate.day()));
  }

  /** Returns true if this date occurs after the testDate
   * parameter. Otherwise returns false.
   **/
  public boolean occursAfter(SimpleDate testDate) {
    return (year() > testDate.year() ||
        (year() == testDate.year() && month() > testDate.month()) ||
	    (year() == testDate.year() && month() == testDate.month() &&
	         day() > testDate.day()));
  }

}

public class DateFormatException extends Exception {
  public DateFormatException(String message) {
    super("\nIncorrect date format: "+ message);
  }
}

February 23, 1998


Please note that the due date for assignment 2A should be MARCH 3, rather
than February 24.

The schedule for tomorrow, Feb 24 has as follows:
    6:10pm   Tutorial on Prolog
    7:10pm   Midterm in LM161
    8:10pm   Lecture

PLEASE ALSO NOTE THAT THE MIDTERM IS CLOSED BOOK.

January 27, 1998

There won't be a tutorial on Tuesday, January 27. Instead, there will be an
office hour in the lecture room (LM161) 6:10 - 7:00. There will also be an
office hour from 5:00 to 6:00 in the instructor's office, Pratt building, rm
290G.

-- John Mylopoulos

January 26, 1998

Dian-in services at CDF: You can use 971-2465, but it costs $25/term. To use
this service, you sign-up in Room 201 of the Engineering Annex.

Otherwise, you should probably get a UTORDial package from the
Information Commons (at Robarts or the SigSam library).

There is no longer any "free" dialin service available on campus.

January 21, 1998

You will be submitting all your  assignments for csc324s electronically  using
the 'submit' command available on CDF machines. Here is how to use it for
Assignment 1A.

	   submit -N  a1  csc324h  a1a.lsp

where	   'submit'   is the command to submit your assignment electronically,
	   '-N  a1'   indicates that you wish to create a subdirectory 'a1' in
		      your submit directory containing  that assignment,
	   'csc324h' is this course,
and	   'a1a.lsp' is the file with your code.

If, for some reason, you decide later that you want to overwrite your earlier
submission (you cannot "unsubmit"), you must explicitly tell 'submit' to do so
with the '-f'  switch:

	       submit  -N  a1  -f  csc324h  a1a.lsp

For more information on how to use submit, type 'man submit' to access manual documentation..




.