UNIVERSITY OF THE WEST INDIES, CAVE HILL CAMPUS
Department of Computer Science, Mathematics & Physics
COMP1105 Computer Programming 1, Semester 1, 2011/2012
Dr. Mechelle Gittens
Mrs. Tessa-King Inniss
Assignment #2
Due: 4pm - Wednesday November 23rd - CMP Administrative Office
In our first assignment we heard the story of Kay:
There was a young lady named Kay
Who brushed her teeth nine times each day.
Her teeth, they would last,
But toothpaste went fast
With 279 brushings in May
You are now required to implement your algorithm in the C-language with several important
modifications required by the doctor. The modifications are underlined so that they are clear to you
the software developer.
After the events of May and the previous months. Kay realised that she had a compulsive need to
brush and do other tasks in her every day activities. She decided to visit a psychologist for a remedy
for this condition.
On visiting Dr. Lee Counsellory, she was diagnosed with Obsessive Compulsive Disorder or OCD.
Obsessive Compulsive Disorder is a disorder of the brain and behavior. OCD causes severe anxiety in
those affected. OCD involves both obsessions and compulsions that take a lot of time and get in the
way of important activities the person values.
As part of Kay's treatment, Dr. Counsellory has commissioned your software consulting firm to design
and implement a software application that can be used to track the activities of people with OCD, so
that he can determine if his primary treatments (pharmaceuticals, hypnosis and/or assisted therapy)
are helping their condition.
The application must let a nurse enter information for a number of patients about the patients' number
of repetitions for various otherwise ordinary activities. The activity information is recorded by each
patient in a simple text file with the following format:
Month Date Day Activity Repetitions
January 1 Monday brushed_teeth 9
January 1 Monday combed_hair 5
January 1 Monday stepped_up_bottom_step 20
January 1 Monday cleaned_basin 40
January 2 Tuesday brushed_teeth 10
January 2 Monday combed_hair 10
January 2 Monday stepped_up_bottom_step 10
January 2 Monday cleaned_basin 20
The text files are all emailed to the nurse at the doctor's office at the end of the month. The nurse
enters the information on the morning of the first day of the next month after all of the patients have
sent in their email.
The activities that may be repeated may include but are not limited to brushing teeth, ironing a single
piece of clothing, cleaning a single item, washing hands, combing/brushing hair and all other distinct
daily tasks - for many patients. However you may assume that there are no more than 30 possible
compulsions performed by all patients under Dr. Counsellory's care.
The following are the details of the requirements of the application.
1. The application is called TrackMe. It must present a greeting to the nurse when the application
starts.
2. The patient must specify the month in which they recorded their information so that the nurse
can ensure that the information is being entered for only one month for all the patients,
3. The patient will record the information in their text file in the manner specified above.
4. The application must read the month, date, day, activity and repetitions and process it toward
the necessary summary.
5. The application must give a final summary of how many times each activity was done on
average per day over the month for each patient.
6. The application must give a final summary of how many times each activity was done on
average per week over the month for each patient.
7. The application must give a final summary of how many times each activity was done for a given
month for a given patient.
8. The application must output each patients' first name, last name and patient ID at the beginning
of the summary of their activity.
9. The application must maintain the names of all patients with any compulsions performed over
20 times in a day on any day. These patients will require special treatment and must be
highlighted to the doctor in the summary at the end. The doctor limits his treatment of patients
with OCD to a maximum of 30 patients so that he can be attentive to their needs.
10. The application must maintain the names of all patients with all compulsions performed less
than 4 daily on each day. These patients do not require further treatment and will require a
completion visit with the doctor.
TrackMe must ask for the name of a text file to read from the nurse for
a patient until that nurse states that there is no more data for the
patients.
It is reasonable to assume that the client does not perform any more
than 30 distinct repetitive activities.
You are required to develop a COMPLETE documented C-language
solution for TrackMe.
Items for submission: You MUST use functions (at least two), parallel arrays, and file processing in your
solution. Your submitted solution MUST include:
1. A typed documented pseudocode algorithm document. [25 marks]
2. C-language documented program included as a .vcproj file with a .cpp file and any included .c
files. Make sure that this can be opened on a computer in one of the labs on
campus and not just on your personal computer. [50 marks]
3. Sample data in files for two patients and two desk traces. The sample data
need only cover up to 10 compulsions per patient. [10 marks]
4. A printed manual that describes how to use your program, with steps
demonstrated with screen captures. [10 marks]
Items 1 – 5 should be included on a CD, and items 1, 4, 5 should be included in printed paper format. If
you make any assumptions please note these assumptions in your solution. Do not make assumptions
that attempt to change the requirements. [2 marks]
Your solution must be submitted to the CMP Department main office as specified above, in a 8 ½ “ x
11” or 8 ½ “ x 14” envelope, with your name, student number, the course name and number, your
instructors name, the assignment number, your email address all written on the envelope, and printed
on your program manual. [1 marks]
Your solution must be typed [2 marks]. There will be NO email submission for this assignment. (If you
have responsibilities that may interfere with your submission time, then try submitting your assignment
early.) Late policy: 1 day late - mark/2; 2 days late – mark/4; more than 2 days late NOT ACCEPTED.
State all assumptions, but do not presume. If you are unclear, ask questions.
This coursework assignment is worth 10% out of 40%
Bonus Question: 25 marks
For those patients with compulsions executed over 20 times the doctor wants to offer them a simple
computer game to play for relaxation. You are therefore asked to use parallel arrays to create a simple
documented tic-tac-toe game program that will:
Display the tic-tac-toe board layout
Allow the user to select a player
Get a valid player square selection within the limits of the board
Get the row index for a the square and then the column index of a square
Insert the relevant X or O
Repeat and check for a winner and display the necessary message
End the game when board filled
Your work is valuable, so good luck!
"Computer science is a dynamic field in which you can combine your creativity with your skills in communication,
mathematics and logic. It will give you a degree that is highly employable in whatever industry you choose. And, by studying
and pursuing a career in computer science, you can help to determine the ways that computers will enrich peoples’ lives in
the future." - University of Calgary, Computer Science Admissions Booklet