Project 4: SunPass Vehicle Classes

A class framework for the SunPass project

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

Operational Objectives: Create (define and implement) classes Box, Cylinder, Plane, Vehicle, Car, Truck, Van, Tanker, and Flatbed.

Deliverables: Five (5) files: vehicles.h, vehicles.cpp, shapes.h, shapes.cpp, and log.txt

Assessment Rubric

build tester.x                       [0..10]:  xx
build trackerHybrid1.x               [0..10]:  xx # our tracker using your shapes and vehicles
tester.x tester.com                  [0..20]:  xx
trackerHybrid1.x < segment_wide.data [0..10]:  xx
code quality, requirements          [-30..0]: (xx)
dated submission deduction       [2 pts per]: (xx)
                                              ---
total                                 [0..50]: xx 

The SunPass Tracker Project

This project simulates an application called tracker for the Florida Turnpike Authority in which data from SunPass transponders is accumulated in real time using various sensing equipment. The sensors detect a SunPass-equiped vehicle and actively inquire further data when that vehicle is a truck. (The data is used, among other things, to charge a passage toll on the vehicle's SunPass account, thus eliminating the need to stop at toll booths. SunPass is valid on all toll roads and bridges in Florida.) For all vehicles a serial number is collected. The serial number can be decoded to determine the vehicle type (car, truck/van, truck/tanker, truck/flatbed), passenger capacity, and, for trucks, the dimensions of its carrier. Trucks actively respond with their DOT license number as well.

Tracker is set up at a specific point on a roadway, near a toll booth or a specific segment of limited access highway. Once activated, it keeps a running account of the SunPass equipped passing vehicles. It can report summary data and also can keep full reports of all vehicles passing the checkpoint within a certain time block. It also keeps track of individual toll charges and can produce a summary of the charges accumulated in a segment.

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

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 the following files from the course home: into your proj4 directory:

    proj4/tester.cpp
    proj4/makefile
    proj4/deliverables.sh
    scripts/submit.sh
    area51/tester_i.x
    area51/tracker_i.x
    

    The naming of these files uses the convention that _s and _i are compiled from the same cource code on program (Sun/Solaris) and linprog (Intel/Linux), respectively. The area51 files are distributed only for your information, experimentation, and testing. You will not need these files in your own project.

  3. Begin a log file named log.txt. This should be an ascii text file in cop3330/proj4 with the following header:

    log.txt # log file for SunPass project
    <date file created>
    <your name>
    <your CS username>
    

    This file should document all work done by date and time, including all testing and test results. A free-form section at the end may be used for any other purpose.

  4. You are to define and implement the following classes: Box, Cylinder, Plane, Vehicle, Car, Truck, Van, Tanker, and Flatbed.

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

  6. File vehicles.h should contain the definitions of the classes Vehicle, Car, 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, and log.txt 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.

Code Requirements and Specifications - Server Side

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

    Class Name:
      Box
    Services (added or changed): 
      float Volume() const // returns volume of box object  
    
    Private variables:
      float length_, width_, height_;
      bool verbose_;
    

    Class Name:
      Cylinder
    Services (added or changed): 
      float Volume() const // returns volume of cylinder object  
    
    Private variables:
      float length_, radius_;
      bool verbose_;
    

    Class Name:
      Plane
    Services (added or changed): 
      float Area() const // returns area of plane object  
    
    Private variables:
      float length_, width_;
      bool verbose_;
    

    Class Name:
      Vehicle
    Services (added or changed): 
      const char*           SerialNumber       () const // returns serial number 
      unsigned int          PassengerCapacity  () const // returns passenger capacity 
      float                 LoadCapacity       () const // returns 0
      const char*           ShortName          () const // returns "UNK"
      float                 Toll               () const // returns toll using fee schedule
      static  VehicleType   SnDecode           (const char* sn)
    
    Private variables:
      char*        serialNumber_;
      unsigned int passengerCapacity_;
    
    Protected variable:
      bool verbose_;;
    

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

    Class name:
      Truck
    
    Inherits from:
      Vehicle  
    
    Services (added or changed): 
      const char*   ShortName          () const  // returns "TRK"
      float         Toll               () const  // returns toll using fee schedule
      const char*   DOTLicense         () const  // returns the license no  
    
    Private variables:
      char* DOTLicense_; 
    

    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 , Plane  
    
    Services (added or changed): 
      float         LoadCapacity       () const  // returns area of plane  
      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
    3. Destructor
    4. Private copy constructor prototype
    5. Private assignment operator prototype
    6. Follow the notation conventions:
      1. Compound names use uppercase letters to separate words likeThis or LikeThis
      2. Class, method, and function names begin with upper case letters LikeThis
      3. Object and variable names names begin with lower case letters likeThis
      4. Class member variables end with underscore likeThis_
  3. Note that Vehicle::verbose_ is protected so that derived classes can access it directly.

  4. 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.

  5. The toll fee schedule is:
    minimum for all vehicles: $2.00
    all trucks: $10.00

  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, the Van destructor should output the message "~Van()" if Vehicle::verbose_ is true.

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

    Type name:
      VehicleType
    
    Enumerated values:
      badSn, vehicle, car, truck, van, tanker, flatbed  
    

  8. The static method VehicleType Vehicle::SnDecode(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
    VehicleType: badSn    vehicle  car      truck    van      tanker   flatbed  
    

  9. After your classes have been fully developed and debugged, so they compile without warnings, it is time to test with tester.cpp.

    Thoroughly test your vehicle objects with this program. Note that this program 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 tester creates the objects with "verbose" set to 1 = true. Then the methods of this object are called. You should see correct serial number (and, for trucks, dot license) 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 tester.cpp both to understand how it works.

Hints