CS 14 - Lab 10
CS 14
Homepage
First Task - Lab Practical
Complete the lab practical as assigned by the TAs.
You will have 1 hour and 40 minutes to complete the practical. You will
turn in your lab using the electronic turnin. WATCH THE TIME! The electronic
turnin will be gone 1 hour and 40 minutes after the scheduled start time of
your lab section and ASBOLUTELY NO LATE LAB PRACTICALS WILL BE ACCEPTED NO
MATTER WHAT THE REASON EVEN IF YOU ARE ONLY 1 SECOND LATE. DO NOT TRUST THE
CLOCK ON YOUR COMPUTER!!! IT IS NOT THE SAME AS THE CLOCK ON THE TURNIN
SERVER. MAKE SURE YOU OPEN A TURNIN PAGE AND REFRESH IT IF YOU WOULD LIKE
TO KNOW THE CURRENT TIME. REMEMBER THAT LAB PRACTICALS ARE 8% OF YOUR GRADE.
DO NOT PUSH THE TURNIN TIME BECAUSE IF YOU MISS THE TURNIN, YOU ARE OUT OF
LUCK.. I suggest that you implement the functions in the order specified
above and turn in a copy of your code each time you get a new function
working so that you can maximize your points.
You may not use ANY reference material at all and, should I even need to
specify that this includes web, IM, chat, email, book, previous code written
by you, code written by anyone, etc. You may not look at ANY reference while
doing this lab practical. You may only look at this web page containing the
lab practical, electrontic turnin, your code that you are currently writing
for the practical, and gdb or ddd.
Second Task - Check out lab 9
Do not forget to demo lab 9 some time today. Lab 9 is due 1 hour after the
end of this lab period.
Third Task - Templatized Insertion Sort
For this lab you will be working alone. There is a lot to do during this lab
section and if you do not finish during lab time, you may finish outside
of lab. The lab is due 24 hours after your lab section ends. However,
try to finish during your scheduled lab time and demo your program during
lab.
You will be writing a templatized version of the insertion sort algorithm.
You will then use your sorting function to sort arrays of ints, floats,
chars, and a user defined class (obtainable here).
The user defined class will consist of
a first name and a last name string. Instances of the class will be sorted
by last name and then by first name. You will need to overload one or more
operators to accomplish the sorting of the class instances.
You will also need the print functions obtainable in
print.cc. Please note that I could have used a template function instead
of giving you 4 different instances of the print function, one for each
type sorted. .25 extra credit points will be available for replacing the print
function with a templatized print function and implementing any necessary
overloaded functions to acheive this.
Note about template functions and g++
To comply with good coding style, you should assume that when creating your
template functions, they should go in a separate file other that where
your main function is in main.cc. However, due to the implementation of
gcc/g++, template functions must appear in the file that has the function
call to those functions. This is not the norm, just happens to be
how gcc/g++ was implemented. You will find that different compilers
will not have this problem. If you had a template class with template
functions,
those could all go in a header file. However, since you are just writing
template functions, don't put them in a header file. Instead, you may put
your templatized function(s) before the main function in my main.cc file.
The TA will then have to visually check the main function to verify
that you have not altered the functionality testing.
Point Breakdown For Lab Assignment
You may demo your program in lab or it will be
graded from your electronic submission (due 24 hours after the end of your
lab section). Please show the output
from main.cc to the TA if you complete the lab.
The TA will also
look at your code for correctness when checking out. Remember, to
receive credit for this lab, you MUST turn the code in online even if
you have already demoed in lab If you do not turn in your code online,
you will lose points for your lab. All code must be turned in online for
archival purposes.
Remeber to compile your code using the flags "-g -Wall -W -Werror -pedantic".
You must use a makefile.
- 2 points - Attendance - Lab attendance will be 20% of the grade for each
lab. You will receive 1 point when the lab begins and 1 point when the lab
ends. Attendance will be taken during the first and last 5 minutes of the
lab period
- 6 point - Correctly sorting ints, doubles, and chars using one templatized
insertion sort function
- 2 point - Correctly sorting the Name class instances using the same
templatized insertion sort function used for ints, doubles, and chars.
- Deductions:
- -1 point - not logically seperating your code into seperate files.
It is okay to put your template functions in the main.cc file.
- -1 point - no makefile
- -5 points - Turned into the wrong lab section.
- -1 point - No name on work turned in
- -5 points - Code not turned in at all. This deduction also applies to
turnins that do not contain a the partners name (only the name that is not
on the turnin will have 5 points deducted. The person that actually turned
the code in will only have 1 point deducted if their name is not on the
turnin).
- -5 points - If your currently assigned partner is in lab and you do not
work together.
- -1 point - If your code seg faults at any time.
- +.5 Extra Credit - Templatizing the print function to work for
ints, chars, doubles, and Name class instances.