For this assignment, you may work in pairs (2 people). All students (whether working in a pair or not) must individually turn in the assignment by individually running the handin program. Therefore, 2 copies of the assignment will be turned in for those working as a pair. The grader will choose to grade only one copy of a pair's work, and assign the same score to both students.
If working in a pair, the names of BOTH students must appear at the top of the turned in assignment.
The purpose of this program is to write some C++ code, as part of a program that uses pointers, structures, objects, and needs a copy constructor.
We have written most of a C++ program for you.
It implements a Queue class, and elements of the queue
are the toy implementation of Process objects.
The main program is a vehicle for testing the Queue and
Process classes,
so it manipulates Queue
objects as well as the Process objects that a
queue holds.
The code for this programming assignment are in the 5 files:
/p/course/cs368-smoler/public/html/assignments/A4/main.cpp
/p/course/cs368-smoler/public/html/assignments/A4/Queue.cpp
/p/course/cs368-smoler/public/html/assignments/A4/Queue.h
/p/course/cs368-smoler/public/html/assignments/A4/Process.cpp
/p/course/cs368-smoler/public/html/assignments/A4/Process.h
Copy each of these files to your own directory.
You will modify Queue.cpp and main.cpp
for this assignment.
Do not change any files other than these two, as you will not be turning
in the other files, and your code must work with the other files in their
original form.
Missing from the program are implementations (definitions)
of 3 Queue member functions:
enqueue,
dequeue, and the copy constructor.
Add them, and modify main() such that it tests
all 3 of these completed functions.
Note that we are completely ignoring proper memory management for this program. This assignment is intended only to give practice programming in C++, and using pointers. You will get your chance to properly implement memory managment in assignment 6.
g++ on the instructional Unix machines.
Your program is expected to compile without warnings or errors
when using g++.
If the name of a single C++ source code program were
p1.cpp, then the
Unix command
g++ p1.cpp
a.out.
Note that this command (given in this manner)
must be executed while your current working directory
(often abbreviated cwd) is the one
containing the C++ source code file.
To place the executable in a file other than a.out,
add another option and argument to the command line:
g++ p1.cpp -o executablename
.cpp
files in the compilation command.
So, to compile the this assignment's program, you may use the
command
g++ main.cpp Process.cpp Queue.cpp -o tryitwhere your executable will then be named
tryit.
g++.
a.out, then
the Unix command to execute this program will be
a.out
./a.out
It should also mostly
main() that intends to test
the functionality of Queue's copy constructor.
We are using the lab-supported handin program, to turn in programs online.
You are modifying and turning in two files. We have all the other files, and we will use our copies when compiling and testing your program.
Your source code files turned in will be
Queue.cpp and main.cpp.
Turn in your program by running the lab-supported handin program.
Instead of following the lab's directions, use this exact command
/s/handin/bin/handin -c cs368-1 -a a4 -d .
while your current working directory is
the one containing the two source code files.
This program copies the specifically named file to
a directory accessible by the instructor and TA.
Some advice, as this is the first assignment turned in online:
The following files where handed in successfully: main.cpp Queue.cppIf one or both of the files are not listed, then something has gone wrong, and you have not yet turned in the program.