CS 680
Spring, 2003
Ethan Bolker
hw7
Due:
In this assignment you get to learn a little C++ and practice some of
the design skills you've been learning all semester. You will build a
small version of a trouble ticket system, like the one in use here in
the department which is invoked when you send email to operator asking for
system assistance.
Our ticket system has three actors: administrator, operator and
submitter. Here's how your program should behave when it's all done:
% ts // main() is in the executable ts
ts-login> administrator
display current status of the ticket system:
number of tickets currently on the queue
number of closed tickets
return to login prompt
ts-login> operator
if there are no tickets in the ticket queue
report that fact
else
get the next ticket from the queue
(high priority before medium before low)
print the ticket information
add the ticket to the set of closed tickets
return to login prompt
ts-login> submit
user name: eb // user responds to prompt
priority: high // allow high, medium and low
description: whatever // any single line of text
assign a ticket number
put a time stamp on the ticket
add the ticket to the ticket queue
return to login prompt
ts-login> quit
%
When printing ticket information for the operator your program should
display
- the current time
- the ticket number
- the user who submitted the ticket
- the priority
- the time at which the ticket was submitted
- the description
Your job is to write C++ code implementing the ticket system.
Here are some design tips.
- Help each other out. Ask and answer questions on the forum. If
you discover something cool or useful post it even if no one has asked
about it.
- Start by making yourself a few CRC cards for the classes you
think you will need, their responsibilities and
collaborators.
- Remember that this is a very small application.
You're writing it to learn C++, not to make your fortune in a startup
company.
Don't do more than I've asked for.
Save your thoughts about
improvements you might make for your memo.
- Write a makefile and keep it up to date.
- Write tests before you write code. Automate them using i/o
redirection. Make tests targets in your makefile.
- Think of ts (for "ticketsystem") as the view and
controller. All i/o goes there. Build a clean model, with just the
right number of classes. One is not enough, and six is almost
certainly too many. Use header files to share API information between
classes.
- Leverage the libraries. Use what C++ provides for string
handling and for containers. Don't write C gussied up to look like
C++. Don't even think of writing a linked list or using an
array. You should be able to find out what you need to know from
Lippman (use the index) or using Google.
- Build and test incrementally. End each coding session with an
application that works even if it doesn't meet all the
requirements. For example, you might start by building a ticketsystem
driver that
lets the three actors log in, reporting successful logins but doing
nothing else.
- Keep your code and your memo up to date. Refactor as
needed. Don't wait until the end to "add the comments."
- Consider a preliminary implementation that uses a queue rather
than a priority queue to store open tickets. If it's hard to make the
timestamps work, ignore them until the end.
Here are things you should not worry about:
- Persistence. It's OK for all the submitted tickets to vanish
when you shut the program down.
- Error handling. Don't bother checking for faulty input to any
of the prompts.
Back to the CS680 home page.