Project 4: DOT Common Carrier Framework

A class framework supporting the DOT FastLane project

Revision dated 09/30/17

Educational Objectives: After completing this assignment the student should have the following knowledge, ability, and skills:

Operational Objectives: Create (define and implement) classes Shape, Box, Cylinder, Rectangle, CommercialVehicle, Carriage, Limo, Bus, Truck, Van, Tanker, and Flatbed.

Deliverables: Six (6) files: vehicles.h, vehicles.cpp, shapes.h, shapes.cpp, makefile, and log.txt

Assessment Rubric

student builds:
 stester.x                           [0..5]:   x
 vtester.x                           [0..5]:   x
assessment builds:
 stester.x                           [0..5]:   x
 vtester.x                           [0..5]:   x
testing:
 stester.x stester.com               [0..5]:   x
 vtester.x vtester.com              [0..25]:  xx
code quality and requirements     [-30..00]: (xx)
dated submission deduction      [2 pts per]: (xx)
                                             ---
total                               [0..50]:  xx 

The DOT FastLane Project

The DOT Common Carrier Framework supports an application known as FastLane for the Florida Deperatment of Transportation in which data from commercial vehicle transponders is collected in real time at all commercial vehicle inspection locations, enabliing pre-certified vehicles with manifests to bypass physical inspection. The sensors detect a FastLane-equiped vehicle and actively inquire further data from the vehicle and screen the data in real time at an inspector's workstation, who can green-light the vehicle, thus avoiding stopping for physical inspection.

We use "FastLane" to encompass the current assignment, which is to develope the DOT Common Carrier Framework, as well as the next project which is to create the Tracker application client. Together these assignments simulate FastLane.

The current assignment focusses on the "server side" of the FastLane project: creating the various classes that are used by a client program to collect data.

Procedural Requirements

  1. Create and work within a separate subdirectory cop3330/proj4. Review the COP 3330 rules found in Introduction/Work Rules.

  2. Begin by copying all files from the course project directory into your proj4 directory. These should include:

    proj4/deliverables.sh
    proj4/stester.cpp
    proj4/vtester.cpp
    

    Also copy the sample executables from area51:

    area51/stester_i.x
    area51/vtester_i.x
    

    Change the permissions on the area51 copies to executable:

    chmod 700 *.x
    

    It is a good idea to start by looking at the source code for the two test programs and running the area51 executables to get a feel for the testing environment. You can run these in batch mode with a com file:

    stester_i.x stester.com
    vtester_i.x vtester.com
    

  3. Begin your log file named log.txt. (See Assignments for details.)

  4. You are to define and implement the following classes: Shape, Box, Cylinder, Rectangle, CommercialVehicle, Carriage, Bus, Limo, Truck, Van, Tanker, and Flatbed.

  5. File shapes.h should contain the definitions of the classes Shape, Box, Cylinder, and Rectangle. File shapes.cpp should contain the member function implementations for these classes.

  6. File vehicles.h should contain the definitions of the classes CommercialVehicle, Carriage, Bus, Limo, Truck, Van, Tanker, and Flatbed. File vehicles.cpp should contain the implementations for these classes.

  7. Turn in the files vehicles.h, vehicles.cpp, shapes.h, shapes.cpp, makefile, and log.txt using the submit script.

    It is assumed that you have an executable copy of the most current submit script LIB/scripts/submit.sh in your ~/.bin available as a command.

    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.

Code Requirements and Specifications - Server Side

  1. You are to define and implement the following classes:

      Class Name:
      Shape
      Services (added or changed): 
      const char* Name   () const  // returns "generic"
      float       Volume () const  // returns volume of object  
      float       Area   () const  // returns area of object  
    
      Protected variables:
      float x_, y_, z_; // dimensions of shape
      bool  verbose_;   // default value 0 given in constructor prototype 
    

      Class Name:
      Box
      Inherits from:
      Shape
    
      Services (added or changed): 
      const char* Name   () const  // returns "box"
      float       Volume () const  // returns volume of box object  
      float       Area   () const  // returns surface area of box object  
    

      Class Name:
      Cylinder
      Inherits from:
      Shape
    
      Services (added or changed): 
      const char* Name   () const  // returns "cylinder"
      float       Volume () const  // returns volume of cylinder object  
      float       Area   () const  // returns surface area of cylinder object  
    

      Class Name:
      Rectangle
      Inherits from:
      Shape
    
      Services (added or changed): 
      const char* Name   () const  // returns "rectangle"
      float       Area   () const  // returns area of rectangle object  
    

      Class Name:
      CommercialVehicle
      Services (added or changed): 
      const char*           Registration       () const // returns vehicle registration number
      const char*           Operator           () const // returns operator ID   
      const char*           CDL                () const // returns operator CDL  
      unsigned int          PassengerCapacity  () const // returns passenger capacity 
      float                 LoadCapacity       () const // returns volume or area of cargo space 
      const char*           ShortName          () const // returns "UNK"
      static  VehicleType   RegDecode          (const char* sn)
    
      Private variables:
      char*          vehicleRegistration_;
      char*          operatorID_;
      char*          operatorCDL_;
      unsigned short passengerCapacity_;
    
      Protected variable:
      bool verbose_; // default value 0 given in constructor prototype
    

      Class name:
      Carriage
    
      Inherits from:
      CommercialVehicle
    
      Services (added or changed): 
      const char* ShortName() const // returns "CAR"  
    

      Class name:
      Bus
    
      Inherits from:
      Carriage
    
      Services (added or changed): 
      const char* ShortName() const // returns "BUS"  
    

      Class name:
      Limo
    
      Inherits from:
      Carriage
    
      Services (added or changed): 
      const char* ShortName() const // returns "LIM"  
    

      Class name:
      Truck
    
      Inherits from:
      CommercialVehicle  
    
      Services (added or changed): 
      const char* ShortName() const // returns "TRK"  
    

      Class name:
      Van
    
      Inherits from:
      Truck , Box  
    
      Services (added or changed): 
      float       LoadCapacity() const  // returns volume of box  
      const char* ShortName() const     // returns "VAN"
    

      Class name:
      Tanker
    
      Inherits from:
      Truck , Cylinder  
    
      Services (added or changed): 
      float       LoadCapacity() const  // returns volume of cylinder  
      const char* ShortName() const     // returns "TNK"
    

      Class name:
      Flatbed
    
      Inherits from:
      Truck , Rectangle  
    
      Services (added or changed): 
      float       LoadCapacity() const  // returns area of rectangle  
      const char* ShortName() const     // returns "FLT"  
    

  2. Each class should have the following:

    1. Default constructor
    2. Parametrized constructor that initializes the class variables; default value for verbose_ is 0 = false. Put the default value in the constructor prototype.
    3. Destructor
    4. Private copy constructor prototype with no implementing code
    5. Private assignment operator prototype with no implementing code
    6. Follow the notation conventions discussed in the Code Standards document.

    Note that (iv) and (v) together ensure that copies of objects cannot be made. Privatizing the copy constructor and assignment operator prototypes will cause a compiler error if client code attemps to make a copy, and not providing implementing code will cause a link error if an attempt is made to copy objects anywhere in the class implementations.

  3. The parameterized constructors for the classes in the framework are required to have the following arguments:

     Class Constructor Parameters
     Shape float x , float y , float z , bool verbose
     Box float width , float length , float height , bool verbose
     Cylinder float radius , float height , bool verbose
     Rectangle float width , float length , bool verbose
     CommercialVehicle
     Carriage , Bus , Limo
     const char* registration , const char* operatorID , const char* operatorCDL , unsigned short passenger capacity , bool verbose
     Truck  const char* registration , const char* operatorID , const char* operatorCDL , bool verbose
     Van  const char* registration , const char* operatorID , const char* operatorCDL , float width , float length , float height , bool verbose  
     Tanker  const char* registration , const char* operatorID , const char* operatorCDL , float radius , float length , bool verbose
     Flatbed  const char* registration , const char* operatorID , const char* operatorCDL , float width , float length , bool verbose

    Only the last argument, verbose, should have a default value of 0 (= false).

  4. Note that CommercialVehicle::verbose_ is protected so that derived classes can access it directly.

  5. Be sure to make exactly the methods virtual that are needed - that is, those that are overridden in derived classes. Do not make a method virtual unless it is needed virtual.

  6. For development and testing of the classes, each constructor and destructor should include a line of code that conditionally sends an identifying message to standard output, whenever verbose_ is 1 = true. For example: if CommercialVehicle::verbose_ is true the Van constructor should output something like "Van(622,Lacher,12345,8.00,10.00,40.00,1)", displaying the actual values of the constructor arguments, and the Van destructor should output the message "~Van()". Run the area51 examples for behavior.

  7. The user-defined type VehicleType is an enumerated type:

      Type name:
      VehicleType
    
      Enumerated values: 
      badReg = 0, vehicle, carriage, bus, limo, truck, van, tanker, flatbed  
    

  8. The static method VehicleType CommercialVehicle::RegDecode(const char* sn) returns the vehicle type based on the first (index 0) character of the serial number sn according to this table:

      sn[0]:  0  1  2  3  4  5  6  7  8
      VehicleType:   badReg  vehicle  carriage  bus  limo  truck  van  tanker  flatbed

  9. Using stester and vtester, it is required that your output match the area51 examples exactly.

  10. After your classes have been fully developed and debugged, so they compile without warnings, it is time to test with the tester programs: stester.cpp tests the shapes classes by themselves (and may be used before the vehicles classes are developed) and vtester.cpp tests the vehicles classes.

    Thoroughly test your objects with these programs before submitting the project, and keep test records in your log.txt. Note that vtester prompts you for a serial number. The serial number is decoded to get a vehicle type, and an object of that type is created dynamically. You should see the constructor calls displayed, in correct order, because vtester creates the objects with "verbose" set to 1 = true. Then the methods of this object are called. You should see correct serial number displayed. An "OOPS" message may be displayed if a problem is detected with your constructors. Finally the object is deleted, and you should see the destructors called in correct order. Read the source code in both tester programs both to understand how they work.

Hints