Revision dated 09/22/18
Educational Objectives: After completing this assignment the student should have the following knowledge, ability, and skills:
Operational Objectives: Create an object-oriented vehicle counter for use by the Department of Transportation (DOT).
Deliverables: tracker.cpp, makefile, log.txt
Ancillary Deliverables: This project depends on copies of these files delivered with the previous project: vehicles.h, vehicles.cpp, shapes.h, and shapes.cpp. These will also be collected by the submission process.
---------------------------------------------------- student build: (3 pts) stester.x [0..1]: x vtester.x [0..1]: x tracker.x [0..1]: x project build: (3 pts) build stester.x [0..1]: x build vtester.x [0..1]: x build tracker.x [0..1]: x compatibility of framework: (4 pts) diff shapes.h [0..1]: x diff shapes.cpp [0..1]: x diff vehicles.h [0..1]: x diff vehicles.cpp [0..1]: x project tests: (40 pts) stester.x stester.com [0..5]: x vtester.x vtester.com [0..5]: x tracker.x < shift1.in [0..5]: x tracker.x < shift2.in [0..5]: x tracker.x < shift3.in [0..5]: x tracker.x < shift4.in [0..5]: x tracker.x < shift_wide.in [0..5]: x tracker.x < shift.paragraph [0..5]: x software engineering: code quality, requirements [-30..0]: ( x) code standards [-10..0]: ( x) dated submission deduction [2 pts per]: ( x) -- total [0..50]: xx ----------------------------------------------------
This project simulates an application called tracker for the Florida Department of Transportation in which data from FastLane transponders is accumulated in real time using various sensing equipment. The sensors detect a FastLane-equiped commercial vehicle (licensed carrier of people or freight) and actively inquire further data from that vehicle. The data is recorded and the vehicle is allowed to proceed without entering the upcoming inspection station, thus saving a great deal of time for both the vehicle operator and the inspection station staff. Of course, there is a one-time inspection required for these vehicles, and electronic guards prevent tampering with inspectable aspects of the vehicle. Data from the one-time inspection is available from a secure cloud database for use by inspectors if required.
For all commercial vehicles the following data is collected:
Additional data is collected depending on the specific type of vehicle:
Note that operators are not counted in passenger capacity, so that there is a strict divide between carriages, which carry people as passengers, and trucks, which carry freight. A carriage may not carry freight and a truck may not carry passengers.
Tracker is set up adjacent to a DOT inspection station. Once activated, it keeps a running account of the FastLane equipped passing vehicles for a period of time called a "shift". At the end of a shift, tracker reports summary data and also creates a detailed log of each instance of a FastLane interaction during that shift.
The current assignment focuses on the "client side" of the FastLane project. The tracker client program uses the CommercialVehicle framework built in the preceeding assignment.
Create and work within a separate subdirectory cop3330/proj5. Review the COP 3330 rules found in Introduction/Work Rules.
Begin by copying all files from LIB/proj5 into your proj5 directory. You should see at least the following files:
shift1.in shift2.in shift3.in shift3.paragraph shift_wide.in makefile.partial deliverables.sh
Also copy area51/tracker_i.x and change its permissions to executable. tracker_i.x is the benchmark executable against which yours will be tested. Note that you can add these lines to your makefile to ensure that you have a current executable benchmark:
tracker_i.x: /home/courses/cop3330p/LIB/area51/tracker_i.x <TAB> cp /home/courses/cop3330p/LIB/area51/tracker_i.x . <TAB> chmod 700 tracker_i.x .
(Also add "tracker_i.x" to the dependencies for the first target.)
Begin your log file named log.txt. (See Assignments for details.)
Copy the various shapes and vehicles files from the preceeding project: shapes.h, shapes.cpp, vehicles.h, and vehicles.cpp. Be sure that these files remain identical to those from the preceding project. If you need to revise these files, you need to resubmit the previous project. (See rubric above.)
If in the current project you find that the shape and vehicle classes require modification, be sure that you make the modifications in both projects and resubmit the preceding one, so that when we check the requirement above your submissions will pass that check.
Create a client program for all of these classes in the file tracker.cpp.
Starting with the contents of makefile.partial, create a makefile that builds all of these executables: tracker.x, stester.x, vtester.x, tracker_i.x, stester_i.x, vtester_i.x.
Test you project thoroughly. Be sure to keep records and report the results in your test diary (part of log.txt).
General Identical Behavior Requirement. Except where specifically noted otherwise, behavior of executables must be identical to those of the area51 benchmark executables.
Turn in the files tracker.cpp, makefile, and log.txt (along with shapes and vehicles files from project 4) using the submit script.
Warning: Submit scripts do not work on the program and linprog servers. Use shell.cs.fsu.edu to submit projects. If you do not receive the second confirmation with the contents of your project, there has been a malfunction.
You are to implement a client program tracker of the CommercialVehicle framework.
Tracker processes data from a file that is input through redirection and sends results to standard output. (Thus tracker does not deal directly with files but reads from and writes to standard I/O.)
Tracker goes through the following processing loop:
Note that the main tracker processing loop continues until zero is read for a shift size. It may be assumed that the file of data is correctly structured so that whenever an appropriate item is expected, it is next in the file. For all vehicles, the data will begin with the serial number sn and then give the remaining information as appropriate. For example, various commercial vehicles would have these lines of data:
reg id cdl <-- vehicle, truck reg id cdl pc <-- carriage, bus, limo reg id cdl width length height <-- van reg id cdl radius length <-- tanker reg id cdl width length <-- flatbed
(where reg, id, cdl are strings, pc is a non-negative integer, and the dimensions are floats.) The dimensional data should be interpreted in the order as shown (and as in the constructors of the truck types.
Tracker should instantiate the objects of a shift using an array whose elements are of type CommercialVehicle *, that is, pointer to type CommercialVehicle. At the end of reading the shift data, this array should have pointers to vehicle objects representing the entire shift. These objects should exist until the line in the report representing the object is generated. NOTE: instantiate the objects with the "verbose" variable set to 0 = false (the default).
Use declared constants (not hardcoded literal values) for the following:
Check for a shift size greater than tracker can handle, and exit if that happens. Thus tracker would exit if either size 0 is read or some size greater than the declared constant 6.i above.
Your tracker.cpp source file should #include <vehicles.h>, but not any of the other project files. Your makefile should create separate object files vehicles.o, shapes.o , and tracker.o and then create the executable tracker.x.
Your tracker project will be tested using the classes that you submit with this project. If you need to revise those, you will need to submit the revisions for that project prior to submitting this project.
Your executables should produce output that is identical to that produced by the corresponding benchmark programs. In particular, these two command:
tracker.x < segment3.data tracker.x < segment3.paragraph
should produce identical output.
To execute tracker on a data file use redirection. For example, enter
prompt> tracker.x < shift2.in
to run tracker.x with the data file shift2.in as input.
Run the benchmark executables for tester and tracker to see how your programs are expected to behave.
Constants used by the benchmark tracker program are as follows:
// global constants const unsigned int C1 = 6, // short name C2 = 10, // pass cap C3 = 10, // load cap c4 = 2, // variable C4 = max Vehicle Registration Number length + c4 c5 = 2, // variable C5 = max Operator ID length + c5 c6 = 2, // variable C6 = max Operator CDL length + c6 maxShiftSize = 100, maxStringSize = 50;
C1, ..., C6 are used as column widths in the table output. Note that C1, C2, C3 are constants whereas C4, C5, C6 are variables declared in main(). The variable widths are calculated as described in the documentation statements.
Here is a code snippet showing how the output tables are formatted:
// output shift data std::cout << " Shift " << shiftCount << " Log\n" << " ===============\n"; std::cout << '\n' << std::setw(C1) << "Type" << std::setw(C2) << "Pass Cap" << std::setw(C3) << "Load Cap" << std::left << " " << std::setw(C4) << "Registration" << std::setw(C5) << "Operator ID" << std::setw(C6) << "Operator CDL" << std::right << '\n'; std::cout << std::setw(C1) << "----" << std::setw(C2) << "--------" << std::setw(C3) << "--------" << std::left << " " << std::setw(C4) << "------------" << std::setw(C5) << "-----------" << std::setw(C6) << "------------" << std::right << '\n';