Algoma University College

Computer Science 3127

Programming Languages

Fall 1996/97

Assignment #4

Pawan Lingras

Date Due: Week 9

Use a word processor and give your submissions a professional look.

  1. Compare and contrast templates and polymorphism.
  2. Discuss advantages of throwing an exception as opposed to returning an error code.
  3. Create a template of a stack with constructor, destructor, pop, push, and peek operations. Use a class called stack_error and two derived error classes stack_full and stack_empty. Write two different functions that pump in numbers in a stack of integers until the stack is full and pump out numbers from the stack until stack is empty. In one function, catch stack_error exceptions in the other catch the stack_full and stack_empty exceptions individually.

Assignment #5

Pawan Lingras

Date Due: Week 10

  1. Represent the following facts as prolog rules:
  1. Run ALS-Prolog to answer the question what other classes did Joe find easy.
  2. Explain how prolog arrived at the answer(s).