- Wednesday 30 April: Leftovers
-
All unreturned assignments and tests
are now at the CSSU office, room 106 of the Engineering Annex.
The CSSU holds irregular office hours, which are posted on their
door.
- Wednesday 23 April: Please check your marks
-
All term marks for 148 are now posted on thec corkboard near my office.
Be sure to check that your marks have been recorded correctly. Report
any errors to me by bringing the relevant marked item to show me your
correct mark.
- Wednesday 23 April: All assignment 3's are available
-
All assignment 3's are now available in the boxes outside my office.
- Wednesday 23 April: Assignment 3a is marked
-
Assignment 3a has been marked. You can check the list of marks on
the corkboard outside my office, or read your email on cdfpc.
- Thursday 17 April: About the exam
-
There are two versions of the final exam: one for OOT students,
and another for C/C++ students. When you arrive at the exam,
make sure that you write the appropriate one!
Each exam says "OOT" or "C/C++" on the front cover, on the back
cover, and at the top of every page.
- Thursday 17 April: Some A3's are ready
-
About half of the Assignment 3's are marked and can be picked up
from boxes in the hallway outside my office. More will appear
there this afternoon and/or tomorrow. Feel free to drop by to
see if yours is there.
I will post an announcement here when I know that all of them are ready.
- Thursday 10 April: The final, and end of term stuff
-
Information about
end of term administrative details and
the final exam
is now available.
- Friday 04 April: Questions about the OOT assignment 3
-
I (Diane) have been receiving a lot of questions in email from
students in Professor Holt's and Professor Fich's classes about
the OOT assignment 3.
My own class is using a completely different assignment
(not just the same assignment in a different language), so it is
best to address your questions to your own professor.
- Friday 04 April: Opportunity to get involved
-
The Compuer Science Students' Union (CSSU) is now accepting nominations
for next year's Executive. If you plan to go on in computer science,
think about getting involved in the CSSU. Being the First-Year Representative
is a great place to start.
Click here for more information.
- Thursday 03 April:
For Diane's class:
-
There is a problem with our grades file.
Students in Diane's class:
If your assignment was marked by Wentao He, you must hand it back in
so we can ensure that your mark was recorded correctly.
To find out who marked your assignment, look for the marker's
signature. Wentao He signed his marking slips with "He".
You can hand your assignments back in to me at lecture, or
in my office.
- Thursday 03 April: C++ Assignment 3 -- testing List
-
As mentioned in lecture, you should write a small driver so that you can
test your List class separately from the simultation program.
Why? Because it will be hard to make all your interesting cases
occur in the context of the simulation.
Question:
To make testing of the List class easier, can I change the details
of the Person class?
Answer:
Yes. As long as you keep the interfaces all the same, it's ok
to simplify details of the Person class to facilitate testing
of the List class.
Be sure to explain what you have done in your testing strategy,
and show where you changed the code.
- Wednesday 02 April: Hint for C++ class
-
Many of you have noticed that
the lecture slides contain a section on recursive binary search tree
operations. You will probably find some of these helpful for
your tree implementation of the List class.
But you cannot blindly translate the code from OOT to C++.
Watch out particularly for how parameters are used,
and keep in mind that parameters work differently in OOT
than in C/C++.
I suggest that you trace the OOT code to see the general algorithm
that is being used, and then write it yourself in C++.
- Wednesday 02 April: Seeing the A2 markers
-
Due to unexpected circumstances, there is a change to the
times when you can talk to markers of assignment 2:
- Wentao He's office hour has been moved from Fri 12-1 to
Thu 5-6
- Ken Xu will cover the Fri 12-1 slot, as well as being
there Thu 5-6 as originally planned.
- Wednesday 02 April: Waiting for stuff?
-
I have a backlog of requests for special consideration, remarking etc.
on my desk. I hope to start ploughing through them today.
As each is taken care of, I give it to the student's professor for
returning in class. So if you're waiting to get something back,
you can expect to get it in lecture.
If, for some reason, you don't get it back before classes end next
week, you'll be able to pick it up from my office before the final.
Thanks for your patience.
- Wednesday 02 April: Due date for assnt 3
-
Question:
The OOT assignment 3 says only:
Due: Week of 7 Apr 97
Is it due on the usual Thursday before 6:00 pm?
Answer:
Yes, the usual.
- Monday 31 March: For Diane's class
-
As suggested in class, I will be using this week's tutorial
for a lecture instead.
My students should go to the lecture hall on Wednesday (April 2nd) at 1:00.
- Thursday 27 March: C/C++ Assignment 3 -- Questions and
Answers
-
Question:
Are we to assume that a binary search tree's structure is as
described on pgs. 287-288 of the lecture notes booklet?
Answer:
Those slides define what makes it a binary "search" tree. Yes,
you are to use these sorts of trees. That means that all of your
operations must maintain the properties of a binary search tree.
Question:
Should the nodes in our trees have parent pointers?
Answer:
No. B.S.T.'s do not normally have parent pointers.
They were used on assignment 2 because you didn't know recursion yet,
and they allowed you to move up and down the tree without it.
Question:
For part 1, instructions say not to alter interface to "List"
class. Does this mean we cannot change names of member functions of
the class, or does it only mean we cannot change the "List" class
name itself?
Answer:
You can change private data members and/or private member functions,
but
you should not change either the class name nor the public members.
Think of it like this: Is there any program that would work using
the old List class but would not work using yours? If so, you have
changed the interface. Here's an example program:
List myList;
That little program wouldn't work if you changed the name of the class
to RevisedList or something.
Question:
In part 1, when revising "List" member function "get_next", how
do you know whether to return a pointer to its left child, or a
pointer to its right child when both exist for a particular parent
node? I was assuming that the child node with the lower index number
was to be returned, but I'm not sure if that's right.
Answer:
It doesn't matter what order get_next returns the elements in.
It must stick to some order though (eg preorder), otherwise there'd be
no way to make sure client code could iterate through a list.
Note that there are private member functions in the List class,
such as "add_to_head", that only make sense as operations on some
sort of linked list structure. They are just helper functions.
When you switch over to the binary search tree version of the class,
you can replace all of these helper functions with your own -- ones
that make sense for a binary search tree. This will not constitute
changing the interface to the List class, because these are all
private member functions.
Question:
For part 1, should "List" class member function "print( )" print
the binary search tree contents in the shape of the tree (as was done
in asmt. #3a)?
Answer:
I think that would be a bad idea. It would betray secrets about
your implementation details (i.e., the fact that you're using a tree),
and that's no business of the client code.
- Thursday 27 March: C students: submit source code, not
executable
-
One student just asked whether he should submit executable or source
code for assignment 3a. Submit source code -- your .c file.
- Thursday 27 March: Revised office hour list
-
The
roster
for TA office hours has been updated to show which TAs are covering
the final office hours this term.
If you want help with assignment 2,
you'll need to go to an OOT or C/C++ TA as appropriate.
(Remember that the OOT and C/C++ sections of the course are doing
entirely different assignment 3s.)
The roster shows which TAs are which.
Note that we have added some extra TA office hours
(not included in the list on the course info sheet) for
the last weeks of term, and that we have put two TAs on some slots.
- Thursday 27 March: Assignment 2 and Midterm 2
-
If you didn't get your assignment or midterm back, you can get it
at Diane's office hours.
(Note that there are no office hours tomorrow due to the holiday.)
If you disagree with or are confused about your midterm 2 or Assnt 2 mark,
click here to find out what you should do.
You must address any concerns regarding these marks by
Friday 04 April.
- Tuesday 25 March: Miscellaneous re the warmup recursion assnt (A3a)
-
Question:
Are we, students in C section, also supposed to name our file of
assignment 3a as "3a.t"?
Answer:
Students in the C section should use the filename "3a.c".
Sorry about that mistake in the handout.
Question:
In the C starter code, the comments to function smallestBiggest
talk about `num' but the argument is called `value'.
What's up?
Answer:
The comment and the code are out of synch
That's an edit-o. :-)
Question:
If there is no value bigger than the given one,
is the function supposed to return (that value minus 1),
or the special value (-1)?
Answer:
The former. The special value -1 wouldn't be an appropriate
answer in this case because it's possible that the tree
contains negative numbers.
So to be sure everyone understands, here's an example.
If the values in the tree are
3 14 -8 22 25
and you asked for the smallestBigger of 50, the number 49 should be
returned.
Question:
I was just wondering if we're allowed to insert additional
functions and procedures into the starter code. It's not
absolutely necessary but I think it would be convenient.
Answer:
Yes, you may add a helper function or procedure.
Question:
I've just finished writing the code for assignment 3a and realized
that it took 25 lines to meet the specs. I was wondering if this sounds
like it's too long. In other words, should I have been able to produce a
working function in fewer lines?
Answer:
It can perhaps be done in fewer lines than that. See if you can simplify
the logic, perhaps by combining cases together.
The most important thing, though, is that you are using recursion properly,
which is an entirely separate issue. You may well me recursing appropriately,
but just be having some difficulty concisesly describing how to combine
answers to the smaller problems.
Question:
Are C students allowed to add
#include "bool.h"
to the starter code, so we can use TRUE and FALSE in the
"smallestBigger" function?
Question:
Yes.
- Tuesday 25 March: OOT students
-
To students in the OOT classes:
Please click
here to see an concerning
a change to your assignment 3.
You should check that page regularly for announcements concerning
your assignment.
- Friday 21 March: C++ Assignment 3 is ready
-
The C++ class's Assignment 3 is now ready -- handout and code.
Follow the
Assignments and Tests
link.
- Thursday 20 March: Solutions to Horton's midterm #2
-
A solution set for Horton's second midterm is available in the course
folder in the Engineering library,
and on the
Assignments and Tests
web page. (Note that you need a postscript viwer to see it online.)
- Wednesday 19 March: OOT code for Assignment 3
-
Students in the OOT sections of 148, your
starter code for assignment 3 is ready.
Click
here
or see the Assignments and Tests
page.
- Thursday 13 March:
Need to give pre- and post-conditions?
-
Question:
Just a clarification. Are preconditions required as part of the
internal documentation? Are postconditions required as well?
Answer:
Postconditions are essential to good documentation; they say what
the code does. Because this is what a programmer would normally write in
their comments above a subprogram, many programmers do not label them
as postconditions. Postconditions can be written in plain English
Preconditions are also very important for good documentation, because
they identify the conditions under which the code will (and will not)
do it's job. They also can be written in plain English (e.g., "num
must be positive"), but because they provide a special alert, I like to
actually label them with the word "preconditions".
- Wednesday 12 March: Assignment 3a available
-
The assignment 3a handout was distributed in lectures recently.
If you missed it, check Diane's corkboard for spare handouts.
It is also available on paper in the Engineering library,
and on this web site under the "Tests and Assignments" page.
The starter code, in both OOT and C,
is available on the "Tests and Assignments" page.
- Tuesday 11 March: Assignment 2 --
Printing graphics output
-
Students who have done the graphics bonus question need a way to
print test runs that show their graphics output. Click
here
for info on how to do this on the CDF PCs.
- Wednesday 05 March: Getting into a CS program
-
There will be an advisory session on getting into Computer
Science programs:
3 - 4 p.m., Wednesday, March 12 in Galbraith 244
You are not required to go -- it's just a good opportunity
to have your questions answered.
- Wednesday 05 March: Horton's midterm solution
-
The solution for Professor Horton's exam is now available
here
and through the Assignments and Tests page.
To look at this solution, you'll need a postscript viewer.
You will also be able to get the solution
on paper in the course folder (Engineering Library).
- Wednesday 05 March: Average midterm marks
-
Averages on the midterms were as follows:
Fich (10:00) section: 14.5/30 = 48.2%
Horton (1:00) section: 16.2/26 = 62.5%
Holt (6:00) section: 15.3/30 = 51.0%
After all the final exam is marked,
we will decide on any adjustments that may be appropriate.
- Wednesday 05 March: Fich's midterm solution
-
The solution for Professor Fich's exam is available
here and through the Assignments and Tests page.
To look at this solution, you'll need a postscript viewer.
You will also be able to get the solution
on paper in the course folder (Engineering Library).
- Thursday 27 February: Midterm solutions
-
The solution for Professor Holt's evening exam is available
here and through the Assignments and Tests page.
Solutions for Horton's and Fich's tests will be made available later.
- Thursday 27 February: Assignment 2 handout on the web
-
The handout for assignment 2 is now available here,
on the Assignments and Tests page.
Update
Monday 3 March: On Thursday I forgot to put a link to A2 handout on
the Assignments and Tests page. It's there now.
You can also get directly to the A2 handout
here.
- Wednesday 26 February: Assignment 1 and Midterm 1
-
If you didn't get your assignment or midterm back, you can get it
at Diane's office hours starting tomorrow, Thursday. (Note that
Diane's Friday hour is cancelled.)
Many people didn't get their assignment back because they didn't
write their TAs name on it. Please learn your TAs name.
Averages and distributions of marks on the assignment and test will
be posted here when available.
If you disagree with or are confused about your midterm or A1 mark,
click here to find out what you should do.
You must address any concerns regarding these marks by
Friday 07 March.
If you want to discuss how you're doing in the course -- perhaps to get
some advice about how to do better, or to help decide whether or not
to drop the course -- please see Diane, or your own instructor in office hours.
- Wednesday 26 February: Assignment 2 -- miscellaneous
questions
-
Question:
Is it ever possible that a house will have NO neighbours?
Answer:
You may assume that, in the initial iqaluit map,
every house has at least one neighbour.
In fact
you may assume that
there is no house or group of houses that is unconnected from
the rest of the town.
Question:
Can we (in the C class)
use the "bool.h" file from Asmt. #1 to define a boolean type?
Answer:
Yes.
Question:
For the "HouseCoords" function in Part 1, I'm unsure of how to
get the function to return TWO values (x and y coords). Should a
struct (in C, or record in OOT) be returned containing the two values?
Answer:
That's one way to send back more than one value through the "return"
statement in C, or the "result" statement in OOT.
However, we also use the word return to just mean "send back somehow".
So another way to return values is through parameters/arguments.
If you implement the HouseCoords operation using parameters called
x and y, then you can use them to send back the two coordinates.
Question:
I'm confused about why one would need the function
"NumberOfHouses" in Part 1. Why would I ever call it when I could
simply write "n" in its place wherever I need n's value in my code?
Answer:
Where will "n" be defined in your code? It should be hidden inside
your module. In that case, the only good way for code outside your
module to get at it is through a subprogram that is part of the
module's interface. That's what NumberOfHouses is.
- Wednesday 26 February: Assignment 2 -- defining the array of
houses in OOT
-
Question:
In Part 1 of the assignment (implementing the ADT for Iqaluit), we don't know
how big to make the array of houses until we read in the number of houses from
the input.
How can you do this inside a Turing module?
Answer:
The array declaration must be part of the loose code, so it stays around
between procedure calls.
The problem is that all the loose code (including the array declaration)
is executed before any procedure (such as ReadInfo) is executed.
Therefore you can't read n inside ReadInfo
and create an array of size n in the loose code.
The simplest solution is to read n in the loose code and read the rest of
the input file using ReadInfo.
This isn't very elegant. Later in the course, we'll see a better way to
do this using classes.
- Wednesday 26 February: Assignment 2 -- Properties of the binary tree in part 4
-
Students have been coming with lots of questions about properties
(iii) and (iv). Probably the easiest way to satisfy them is to
make sure that:
- every level of the tree is completely full, except possibly
the bottom level.
- if the bottom level is not full, all the nodes it does have
are to the left of that level.
One result of taking this approach is that you always know where
the next node would have to go if you needed to add a new node
to the tree structure.
- Wednesday 26 February: Assignment 2 -- Hint
-
The tree in part 4 has special properties that all operations on it
must maintain.
Some students have been asking for help on how to implement certain
operations. Here are some hints:
- If you want to add a new node,
make it the rightmost leaf in the bottom level.
Then make changes going up the tree so that condition (i)
is satisfied.
- If you want to delete a node, you will leave a hole.
Use the rightmost leaf in the bottom level to fill that hole,
and then make changes so that condition (i) is satisfied.
It is your job, as part of defining the ADT in part 2,
to decide exactly what the necessary operations are.
Warning: we are not endorsing the above operations as appropriate
for your ADT.
We are just suggesting how you might implement them if you
decide they are appropriate.
- Tuesday 25 February: Do you need an old handout?
-
All handouts are distributed in class.
If you missed class or have lost your copy, here are the places where
you can go to get another one:
- On the corkboard outside SF2302.
Spare copies always go there.
If there aren't any copies there, it means we've run out.
- In the course folder in the Engineering Library
(2nd floor of SF, room 2402).
The folder contains a single copy of all handouts. You may make
your own photocpy from there.
- On the course web site.
Many handouts are available there.
- Tuesday 25 February: For Diane's class
-
As announced in class, I will be using this week's tutorial
for a lecture instead.
So my students should go to the lecture hall on Wednesday (the 26th) at 1:00.
- Sunday February 23rd: Assignment 2 -- defining the array of houses
in C
-
Question:
In Part 1 of the assignment (implementing the ADT for Iqaluit),
we don't know how big to make the array of houses until we read in
the number of houses from the input.
How can you do this in C?
Answer:
The simplest solution is to declare an array that you think
will be big enough and then use only as much of it as you need.
Here's an example with an array of integers:
#define MAX_SIZE 100 /* You could choose a different limit */
int myarray[MAX_SIZE];
You would have to keep track of how much of the array
is occupied, so that you can use that number in loop bounds and so on.
In your case, the number of houses is the number of occupied spots in
the array.
You could make it a precondition of your code that the
number of houses read in is <= MAX_SIZE.
This solution is not ideal; if you don't run out of space, you're probably
wasting space.
A better solution is to declare the array as a pointer, and defer
allocating any actual space for it until you know what you'll need.
At that point, you can use malloc to grab the right amount
of memory. Example:
int *myarray; /* No memory is reserved for it yet. */
int n;
/* Later, when you know n, you can get the right amount of memory: */
myarray = malloc(n * sizeof(int));
See King, section 17.3 for details.
In Turing it's much simpler;
you can do things like this directly:
var n: int
get n
var myarray : array 1..n of int
- Sunday February 23rd: Assignment 2 -- BeginGettingNeighbour
-
Question:
I'm confused about the operations GetAnotherNeighbour and
BeginGettingNeighbour.
Answer:
The basic idea is that we need some way to loop through the neighbours
of a house, in order to implement the "for each neighbour..." line
within the while loop of the algorithm. It's easy to loop through
a sequence of integers, but there is nothing built into OOT or C for
looping through neighbours!
GetAnotherNeighbour(h,h',c) is our way of dealing with this. If you
use this operation repeatedly with the same h, it will give you back
all the neighbours of h, in some order which you can't control. For
example, say house 27 has 10 neighbours. If you did this:
GetAnotherNeighbour(27,n,c)
print n and c
GetAnotherNeighbour(27,n,c)
print n and c
GetAnotherNeighbour(27,n,c)
print n and c
GetAnotherNeighbour(27,n,c)
print n and c
you would have printed out 4 neighbours of house 27, along with
the costs for paving between each of them and house 27. Since
GetAnotherNeighbour returns the special value 0 if there are no
more neighbours, you can make a loop to keep calling GetAnotherNeighbour
until there are no more. (Note: C students should probably use -1 for
this special value, since they will probably count their houses starting
from 0.)
Can GetAnotherNeighbour return the same neighbour more than once?
Not unless we call BeginGettingNeighbours, which will allow us to start
all over (and hence to get neighbours that we may have gotten before).
For example:
BeginGettingNeighbours (27) (Get ready)
GetAnotherNeighbour(27,n,c) (Get and print 2 neighbours of 27; they will
print n and c not be the same as each other)
GetAnotherNeighbour(27,n,c)
print n and c
BeginGettingNeighbours (27) (Start over)
GetAnotherNeighbour(27,n,c) (Get and print 2 neighbours of 27; they will
print n and c not be the same as each other, but could
GetAnotherNeighbour(27,n,c) be repeats of the 2 neighbours retrieved
print n and c above)
BeginGettingNeighbours must also be called before the very first time
we use GetAnotherNeighbour.
What should BeginGettingNeighbours do? Whatever is necessary to
allow GetAnotherNeighbour to keep track of which neighbours have
been returned and which haven't.
- Friday 21 February: Office hour cancellation
-
Diane's office hour on Friday, February 28th is cancelled.
- Saturday 15 February: Assignment 0 is marked
-
Your assignment 0 mark
has been / is being mailed to you now.
Students who do not get a perfect mark will receive
an explanation of where they lost marks. The test cases to which
this explanation refers will be posted here next week.
- Saturday 15 February: Copies of Assignment 2
-
The assignment has been out for more than a week now, so I hope everyone
has a copy. If you don't, or if you have lost yours, you can get a new
copy from the envelopes on my corkboard (outside SF 2302), or from the
course folder in the Engineering Library.
The assignment will also be available later on the web.
- Thursday 06 February: Midterm next week
-
As written in the course information sheet, the first term test will
be held in tutorial next week.
For Prof. Holt's evening section, this test will be at 8:10 in your tutorial
on Tuesday 11 Feb. The test for the evening section will cover all
material covered in lecture, except for the material on proofs done
this week.
Students in the day sections will have their test on in their tutorial
on Wednesday 12 Feb, at 10:00 for Fich's section, and 1:00 for Horton's.
Fich and Horton will discuss the test in lecture tomorrow.
- Thursday 06 February: Test runs in C
-
Click here for instructions on how to produce
printed test runs in C for assignment 1.
- Wednesday 05 February:
on Assignment 1
-
Due to the problem with printing C assignments (see below), in addition
to the other glitches,
the assignment 1 deadline has been extended until 6:00 pm Friday.
This extension applies to all St George students,
regardless of whether they are in a C or OOT section.
Students who hand in the assignment by the original deadline
(6:00 Thursday) will receive a 10% bonus.
No assignments will be accepted after the Friday 6:00 deadline.
Please pass the word on to other students who may not have seen
this announcement.
- Wednesday 04 February:
Problem with Print C Assignment
-
Print C Assignment apparently was not designed for programs with multiple
source files, so you won't be able to use it as it is to produce test
runs for this assignment.
We're working on a solution to this problem right now,
and will announce it here.
(If you know how to redirect input and output under DOS, you can use
that to create test runs. We're just trying to come up with a simpler
method.)
- Tuesday 03 February: Part D of Assignment 1
-
Question:
Do we add the preconditions/comments to the time.h (header file) or to
the time.c (implementation file).
Answer:
Add your preconditions/comments to the time.h file (for C students)
or the time.tu file (for OOT students).
Question:
The instructions are slightly
hazy on the question of whether we are allowed to improve the actual code.
Answer:
Don't improve the code. Your preconditions are meant to simply document
the conditions under which the code, as it is currently written, will work.
- Tuesday 03 February: Advice re Assignment 1
-
Now is a good time to step back and assess where you are on the assignment.
If you feel confident that you'll finish all of the parts (including
producing nice, organized test runs, packaging everything up nicely, etc.),
great. If you're not confident of this, don't panic.
The assignment was designed to
be modular, so that you can complete recognizable parts even if you
don't get all of it done. (And you can see from the marking scheme
roughly what the parts are worth.)
The important thing is that you leave yourself enough time to produce
an organized package to hand in, and that you use test runs to
demonstrate clearly what you did get working. If you got something
partly working, describe the remaining bugs and the missing parts in
your Bugs and Missing Features section of the report.
We know that dealing with someone else's code takes a lot of time,
especially when there are bugs. We took this into account when designing
the assignment, and will take it into account again later if we find that
marks were unexpectedly low on the assignment.
You may be happy to know that for assignment 2, you will get to write
all of the code yourself from scratch.
Freedom!
- Tuesday 03 February:
How to produce printed test runs for assignment 1
-
In the PC lab environment, you will find both a "Print C assignment" icon
and a "Print OOT assignment" icon.
They both work the same way. You are asked to specify the name of
the program/source file, and the name of one or more data files.
Here's how it works in the simplest case,
when if you specify just one data file:
-
Your program is run, but every input statement
that would normally take input from the keyboard
(statements like plain "get" in OOT, or "scanf" in C)
take their input from your data file instead.
This means that you must have already created the data file,
and stored in it exactly the inputs for your program
that you would normally type in from the keyboard.
Note that input statements that specify a file
(statements like "get" with a stream number in OOT, or "fscanf" in C)
still take their input from the file that they specify.
So the Load operation in your program will still read appointments
from the "apptcal.dat" file.
-
Then your program is printed, along with, the data file,
and all output that would normally go to the screen.
This is part of what you should hand in.
What will not be printed automatically is any input file
that your program explicitly reads from
(using statements like "get" with a stream number in OOT, or "fscanf" in C)
or any output file that your program explictly writes to
(using statements like "put" with a stream number in OOT, or "fprintf" in C).
You'll have to print these separately.
For your current assignment, the only such files are the original
apptcal.dat file, and the new apptcal.dat file that you may have created
(if one of the commands given to the program was a Save command).
If you want to run your program on several sets of input commands,
you can specify a number of data files when using "Print C/OOT assignment".
- Tuesday 03 February: Cover Sheet for Assignment 1
-
The assignment cover sheet is available
here.
Please fill it out and attach it to the outside of your envelope when you
hand the assignment in.
Or, handwrite the same information, in the same format
on the front of your envelope.
- Tuesday 03 February: Assignment 1 -- PackAppts in the C code
-
I wrote on Friday that
function PackAppts in apptcal.c (linked list version) was probably not correct.
Note that PackAppts
is not called by any of our code.
You have permission to do whatever you like with it, including ignore it.
If you are going to use it, you should take a look at a new version,
available through the Assignments and Tests page, or by clicking
here.
- Monday 02 February: Assignment 1 -- Sample output
-
Click
here to see what output from
the View Week and View Day operations might look like.
- Monday 02 February: Assignment 1 -- A Copy procedure for the OOT code
-
Procedure "enqueue" in queue.tb calls procedure "Appointment.Copy", which
doesn't currently exist in appt.tb.
Click
here to get a Copy procedure.
- Monday 02 February: Assignment 1 --
Input file format for C code
-
The C code (for LoadAppt in appt.c) expects the apptcal.dat file
to say "fixed" if an appointment is fixed. The data file originally
posted said "true" instead. This won't stop your program from running,
but it will never consider any appointment to be fixed.
A revised data file is available on the C code page, or
by clicking
here.
(Note that the OOT code does use the string "true".)
- Friday 31 January: Assignment 1 -- Miscellaneous questions
-
Question:
I can see why I need to use footnotes when doing a View Week operation
in the linked list version of the program.
But what about when doing a View Day operation?
Can I just use as many rows of output as I need to print the appointments
that occur in a 30-minute time slot?
Answer:
For both View Day and View Week,
and for both the array and linked list implementations,
you are to use one row of output for each 30-minute time slot.
This means that the linked list version of View Day will indeed
need to use footnotes as View Week does.
Question:
Should view week list the current day in
the first column or should it always put Monday in the first column.
Answer:
View week should begin with the current day.
For example if today is Thursday, begin with today's appointments,
and follow with
tomorrow's, Monday's, Tuesday's and Wednesday's.
Question:
Part B says that the order of all previously booked
appointments should not change. Am I correct in assuming that the
movement of non-fixed appointments is limited only to the vacant
spaces before the next appointment?
Answer:
Non-fixed appointments can be pushed forwards or backwards in time,
but only up to the point where they "bump into" a fixed appointment.
This means that the order of the elements in your linked list will
not change. As a result, performing a Fit operation
will never require altering the structure of your linked list;
you can just change the start times and end times of some appointments in it.
Question:
Does all of the input come from a file or can it come from the keyboard?
Answer:
The program is meant to be interactive, so that most input comes from
the keyboard. When the user requests a Load operation, however,
input is taken from the file apptcal.dat.
When you hand in your assignment, you will need to produce test runs
that show what the user input was.
This leads us to the next question ...
Question:
C students only:
What is the recommended method for printing test runs using Borland?
Answer:
I'll get back to you on that.
Question:
C students only:
Can the Roberts libraries be used for the bonus question (mouse stuff)
Answer:
Yes.
- Friday 31 January: Assignment 1 -- the OOT code
-
-
The handout says that, in the array implementation,
empty appointments should be represented by an empty string.
Most people would probably take that to mean the null string, "".
But in the file "appt.tu", Empty is defined as a string of 15 blanks.
This is so that when printing an appointment,
you don't need a special case for empty ones.
- Friday 31 January: Assignment 1 -- the C code
-
- Friday 31 January: Assignment 1 -- Hint for C students
-
In queue.h we define a type for queues:
typedef struct queueType {
elementType elements[MAX_LENGTH];
int head;
int tail;
int size;
} Queue;
As a client of the queue code, your apptcal.c code can now
create its own queue.
Whenever you want to do anything to your queue, even just examine it,
always use the functions that queue provides for you (enqueue, etc.).
Never go look at the pieces of the struct.
This would make your code dependent upon the particular queue
implementation currently used. Your code might no longer work
if that implementation were changed.
Another advantage of sticking to this rule is that you don't
have to be aware of how the queue is implemented.
It is a lot easier to write your View Week operation, for example,
if you can ignore the details of how the queue works, and just assume
it does its job somehow.
- Thursday 30 January: Assignment 1 -- What's a queue?
-
For the linked list version of View Week, you are to use a queue.
We don't expect that you already know what a queue is.
In short, a queue is a lineup: things enter at the back and leave
from the front, as you would when lining up to use a bank machine, for example.
To find out more, read 6.1-6.2 of BHH, or 7.3 of Standish, as suggested in
the handout.
If, after reading this, you are not clear on what a queue is, drop by
to office hours.
- Wednesday 29 January: Assignment 1
-
-
In both the C and OOT code, there was a small bug in the time module's
Difference function. Revised code has been posted. (Follow
the "Assignments and Tests" link below.)
-
You can count on there being a few more small bugs in the code.
Watch this page for announcements.
-
In the C starter code, the web page was pointing to the wrong
file for the array version of the apptcal.h file. This has been
fixed. Make sure that you have a copy of the correct file.
Surprisingly, only 1 student seems to have noticed this.
-
My impression is that students have not put much time into the assignment yet.
Please do give it some thought soon. Most students simply cannot
do this sort of assignment in the last couple of days.
Try at least to do enough that you uncover the biggest questions you
need to ask us -- in time to ask them.