Hello I am having problems with this assignment could you help me complete it??
ID: 3579317 • Letter: H
Question
Hello I am having problems with this assignment could you help me complete it??
Educational Objectives: After completing this assignment the student should have the following knowledge, ability, and skills:
Define static (compile time) polymorphism
Define dynamic (run time) polymorphism
Use a class hierarchy to implement dynamic polymorphism
Operational Objectives: Create (define and implement) classes Box, Cylinder, Plane, Vehicle, Car, Truck, Van, Tanker, and Flatbed and an object-oriented vehicle counter for use by the Department of Transportation (DOT).
Deliverables: Two (2) files: tracker.cpp, log.txt
Deliverables Note: This project depends on these files delivered with the previous project: vehicles.h, vehicles.cpp, shapes.h, shapes.cpp
Assessment Rubric
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 "client side" of the SunPass project. Using the various DOT Vehicle classes built in the preceding assignment, we build the tracker client program.
Procedural Requirements
Create and work within a separate subdirectory cop3330/proj5. Review the COP 3330 rules found in Introduction/Work Rules.
Begin by copying the following files from the course home: into your proj5 directory:
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.
Begin a log file named log.txt. This should be an ascii text file in cop3330/proj5 with the following header:
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.
Begin by copying the various shapes and vehicles fils from the preceding project: shapes.h, shapes.cpp, vehicles.h, and vehicles.cpp. Be sure that these files remain identical to those from the preceding project.
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.
Turn in the files tracker.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 - Client Side
You are to implement a client program tracker of the vehicle system described above.
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:
Read the number of vehicles in the next segment
If the number is zero, exit
For each vehicle in the segment,
Decode the vehicle serial number
If other data is needed, read that data
Create a vehicle of the appropriate type using the data read in the previous steps
Update various summary information for this segment
After all the vehicles in the segment have been read and their corresponding objects created, report a summary of the various vehicles by type, along with the totals of tonnage and tolls of the segment.
After the summary, report the details: for each vehicle in the segment:
Report the vehicle data to screen
Release the memory used to store the vehicle
When in doubt, use the distributed area51 executables as a guide to output data and formatting.
Note that the tracker processing loop continues until zero is read for a segment 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 passenger capacity pc. For all specific truck types, the next entry will be the DOTlicense DOTL followed by the dimension data d1 d2 d3(optional). For example, a car, truck, van, tanker, and flatbed would have these lines of data:
The dimensional data should be interpreted in the order d1 = length, d2 = width or radius, d3 = height. Note that this is more or less self-documenting in the data file segment0.data. Note also that we will assume that each vehicle and its data are in a separate line of the input file.
Tracker should instantiate the objects of a segment using an array whose elements are of type Vehicle *, that is, pointer to type Vehicle. At the end of reading the segment data, this array should have pointers to vehicle objects representing the entire segment. 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:
The maximum number of vehicles in a traffic segment (100)
The maximum number of characters in a vehicle serial number (50)
The maximum number of characters in a truck DOT license (50)
Check for a segment 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. The distributed 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 have previously submitted for the previous project. If you need to revise those, you will need to submit the revirions for that project prior to submitting this project.
Hints
Model executable tracker.x is for your information only - it is not needed for your project.
To execute tracker on a data file use redirection. For example, enter
prompt> tracker.x < segment2.data
to run tracker.x with the data file segment2.data as input.
Run the distributed executables for tester and tracker in LIB/area51/ to see how your program should behave.
Here are my .cpp and header files that are used in this project
shapes.h
#ifndef SHAPES_H
#define SHAPES_H
class Box
{
public:
Box(); // default constructor
Box(float, float, float, bool x= false); // 3-arg constructor
virtual ~Box(); // destructor
float Volume() const; // returns the volume of a box object
private:
Box (const Box& b); // private copy constructor
Box& operator= (const Box & b); // private assignment operator
float length_;
float width_;
float height_;
bool verbose_;
};
class Cylinder
{
public:
Cylinder(); // default constructor
Cylinder(float, float, bool y= false); // 2-argument constructor
virtual ~Cylinder(); // destructor
float Volume() const; // returns the volume of a box object
private:
Cylinder (const Cylinder& c); // private copy constructor
Cylinder& operator= (const Cylinder & c); // private assignment operator
float length_;
float radius_;
bool verbose_;
};
class Plane
{
public:
Plane(); // default constr
Plane(float, float, bool z = false); // 2-arg constructor
virtual ~Plane(); // decosntructor
float Area() const; // returns the area of a plane object
private:
Plane (const Plane& p); // private copy constructor
Plane& operator= (const Plane & p); // private assignment operator
float length_;
float width_;
bool verbose_;
};
#endif
shapes.cpp
#include <iostream>
#include <shapes.h>
#include <cmath>
Box::Box(): length_(0), width_(0), height_(0), verbose_(0)
{
if(verbose_)
std::cout << "Box() ";
}
Box::Box(float length, float width, float height,
bool x ):
length_(length), width_(width), height_(height),
verbose_(x)
{
if(verbose_)
std::cout << "Box() ";
}
Box::~Box()
{
if(verbose_){ std::cout << "~Box() ";}
}
float Box::Volume() const
{
return length_ * width_ * height_;
}
Cylinder::Cylinder(): length_(0), radius_(0), verbose_(0)
{
if(verbose_)
std::cout << "Cylinder() ";
}
Cylinder::Cylinder(float length, float radius,bool y):
length_(length), radius_(radius), verbose_(y)
{
if(verbose_)
std::cout << "Cylinder() ";
}
Cylinder::~Cylinder()
{
if(verbose_)
std::cout << "~Cylinder() ";
}
float Cylinder::Volume() const
{
return M_PI * radius_ * radius_ * length_;
}
Plane::Plane(): length_(0), width_(0), verbose_(0)
{
if( verbose_)
std::cout << "Plane() ";
}
Plane::Plane(float length, float width, bool z):
length_(length), width_(width), verbose_(z)
{
if(verbose_)
std::cout << "Plane() ";
}
Plane::~Plane()
{
if(verbose_)
std::cout << "~Plane() ";
}
float Plane::Area() const
{
return length_ * width_;
}
VEHICLES.h
#ifndef VEHICLES_H
#define VEHICLES_H
#include <shapes.h>
enum VehicleType { badSn, vehicle, car, truck, van, tanker, flatbed };
class Vehicle
{
public:
Vehicle(); // default constructor
Vehicle(char*, unsigned int, bool a = false ); // 3-arg constructor
virtual ~Vehicle (); // destructor
const char* SerialNumber() const; // returns serial number
unsigned int PassengerCapacity() const; //returns passenger capacity
virtual float LoadCapacity() const; // returns 0
virtual const char* ShortName() const; // returns "UNK"
virtual float Toll() const; // returns toll using fee schedule
static VehicleType SnDecode(const char* sn);
protected:
bool verbose_;
private:
Vehicle(const Vehicle& v);
Vehicle& operator= (const Vehicle& v);
char * serialNumber_;
unsigned int passengerCapacity_;
};
class Car : public Vehicle
{
public:
Car();
Car(char*, unsigned int, bool b = false);
virtual ~Car ();
const char* ShortName() const; // returns "CAR"
private:
Car(const Car& v);
Car& operator= (const Car& v);
};
class Truck : public Vehicle
{
public:
Truck();
Truck(char*, unsigned int, char*, bool c = false);
virtual ~Truck ();
const char* ShortName () const; // returns "TRK"
float Toll () const; // returns toll using fee schedule
const char* DOTLicense () const; // returns the license no
virtual float LoadCapacity() const;
private:
char *DOTLicense_;
Truck (const Truck& v);
Truck& operator= (const Truck& v);
};
class Van : public Truck, public Box
{
public:
Van();
Van(char*, unsigned int, char*, float, float, float, bool d = false);
virtual ~Van();
float LoadCapacity() const; // returns volume of box
const char* ShortName() const; // returns "VAN"
private:
Van (const Van& v);
Van& operator= (const Van& v);
};
class Tanker : public Truck, public Cylinder
{
public:
Tanker();
Tanker( char*, unsigned int, char*, float, float, bool e = false);
virtual ~Tanker();
float LoadCapacity() const; // returns volume of cylinder
const char* ShortName() const; // returns "TNK"
private:
Tanker (const Tanker& v);
Tanker& operator= (const Tanker& v);
};
class Flatbed : public Truck, public Plane
{
public:
Flatbed ();
Flatbed (char *, unsigned int, char *, float, float, bool g = false);
virtual ~Flatbed();
float LoadCapacity () const; // returns area of plane
const char* ShortName () const; // returns "FLT"
private:
Flatbed (const Flatbed& v);
Flatbed& operator= (const Flatbed& v);
};
#endif
Vehicles.cpp
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vehicles.h>
#include <shapes.h>
VehicleType Vehicle::SnDecode(const char *sn)
{
VehicleType x;
//std::cout << "sn = " << sn << " ";
//std::cout << "sn[0] = " << sn[0] << " ";
switch (sn[0])
{
case '1':
x = vehicle;
break;
case '2':
x = car;
break;
case '3':
x = truck;
break;
case '4':
x = van;
break;
case '5':
x = tanker;
break;
case '6':
x = flatbed;
break;
case '0':
x = badSn;
break;
default:
x= badSn;
}
return x;
}
Vehicle::Vehicle(): serialNumber_(NULL), passengerCapacity_(1), verbose_(0)
{
if(verbose_)
std::cout << "Vehicle() ";
serialNumber_ = new char [2];
serialNumber_[0] = '#';
serialNumber_[1] = '';
}
Vehicle::Vehicle(char *serialNumber,
unsigned int passengerCapacity,
bool a):
serialNumber_(NULL),
passengerCapacity_(passengerCapacity), verbose_(a)
{
if(verbose_)
{
std::cout << "Vehicle() ";
}
size_t size = strlen(serialNumber);
serialNumber_ = new char [1+size];
serialNumber_[size] = '';
strcpy(serialNumber_, serialNumber);
}
Vehicle::~Vehicle()
{
if(verbose_)
{
std::cout << "~Vehicle() ";
}
delete [] serialNumber_;
}
const char *Vehicle::SerialNumber() const
{
return serialNumber_;
}
float Vehicle::LoadCapacity() const
{
return 0.0;
}
unsigned int Vehicle::PassengerCapacity() const
{
return passengerCapacity_;
}
const char *Vehicle::ShortName() const
{
return "UNK";
}
float Vehicle::Toll() const
{
return 2.00; // Non-Truck toll
}
Car::Car(): Vehicle()
{
if(verbose_)
std::cout<< "Car() ";
}
Car::Car(char *serialNumber,
unsigned int passengerCapacity,
bool b):
Vehicle( serialNumber, passengerCapacity, b)
{
if(verbose_)
std::cout << "Car() ";
}
Car::~Car()
{
if(verbose_)
std::cout << "~Car() ";
}
const char *Car::ShortName() const
{
return "CAR";
}
Truck::Truck(): Vehicle(), DOTLicense_(NULL)
{
if(verbose_)
std::cout << "Truck() ";
DOTLicense_ = new char [2];
DOTLicense_[0] = '#';
DOTLicense_[1] = '';
}
Truck::Truck(char *serialNumber,
unsigned int passengerCapacity,
char *DOTLicense,
bool c):
Vehicle(serialNumber, passengerCapacity, c),
DOTLicense_(NULL)
{
if(Vehicle::verbose_)
std::cout << "Truck() ";
size_t size = strlen(DOTLicense);
DOTLicense_ = new char [1+size];
DOTLicense_[size] = '';
strcpy(DOTLicense_, DOTLicense);
}
Truck::~Truck()
{
if(verbose_)
{
std::cout << "~Truck() ";
}
delete [] DOTLicense_;
}
float Truck::LoadCapacity() const
{
return Vehicle::LoadCapacity();
}
const char *Truck::ShortName() const
{
return "TRK";
}
float Truck::Toll() const
{
return 10.00; // Truck toll
}
const char *Truck::DOTLicense() const
{
return DOTLicense_;
}
Van::Van(): Truck(), Box()
{
if(Vehicle::verbose_)
std::cout << "Van() ";
}
Van::Van(char *serialNumber,
unsigned int passengerCapacity
,char *DOTLicense,
float length,
float width,
float height,
bool d):
Truck(serialNumber, passengerCapacity, DOTLicense),
Box(length, width, height)
{
if(Vehicle::verbose_){std::cout << "Van() ";}
}
Van::~Van()
{
if(Vehicle::verbose_)
std::cout << "~Van() ";
}
float Van::LoadCapacity() const
{
return Box::Volume();
}
const char *Van::ShortName() const
{
return "VAN";
}
Tanker::Tanker(): Truck(), Cylinder()
{
if(Vehicle::verbose_)
std::cout << "Tanker() ";
}
Tanker::Tanker(char *serialNumber,
unsigned int passengerCapacity,
char *DOTLicense,
float length,
float radius,
bool e):
Truck(serialNumber, passengerCapacity, DOTLicense),
Cylinder(length, radius)
{
if(Vehicle::verbose_)
std::cout << "Tanker() ";
}
Tanker::~Tanker()
{
if(Vehicle::verbose_)
std::cout << "~Tanker() ";
}
float Tanker::LoadCapacity() const
{
return Cylinder::Volume();
}
const char *Tanker::ShortName() const
{
return "TNK";
}
Flatbed::Flatbed(): Truck(), Plane()
{
if(Vehicle::verbose_)
std::cout << "Flatbead() ";
}
Flatbed::Flatbed(char *serialNumber,
unsigned int passengerCapacity,
char *DOTLicense,
float length,
float width,
bool g):
Truck(serialNumber, passengerCapacity, DOTLicense),
Plane(length, width)
{
if(Vehicle::verbose_)
std::cout << "Flatbed() ";
}// Truck and Plane constructor initializations
Flatbed::~Flatbed()
{
if(Vehicle::verbose_)
std::cout << "~Flatbed() ";
}
float Flatbed::LoadCapacity() const
{
return Plane::Area();
}
const char *Flatbed::ShortName() const
{
return "FLT";
}
And here is what I have done so far
Tracker.cpp
#include <vehicles.h>
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cstring>
const size_t maxSegSize = 100; // 0-100 segment[100] = ''
const int maxSn = 20;
const int maxDot = 20;
int main()
{
char sn[maxSn];
char dot[maxDot];
size_t sSize;
Vehicle *segment[maxSegSize];
VehicleType v; // type of vehicles
std::cout << " Tracker started... ";
unsigned int pc;
float d1;
float d2;
float d3;
int badSnTotal= 0;
int vehicleTotal = 0;
int carTotal = 0;
int truckTotal = 0;
int vanTotal = 0;
int tankerTotal = 0;
int flatbedTotal = 0;
float tonnage = 0;
float tolls = 0;
while(std::cin >> sSize && segSize != 0)
{
for (size_t i = 0; i < sSize; ++i)
{
std::cin >> sn;
v = Vehicle::SnDecode(sn);
switch ( v )
{
case badSn:
++badSnTotal;
std::cin >> pc;
segment[i] = new Vehicle(sn, pc);
break;
case vehicle:
++vehicleTotal;
std::cin >> pc;
segment[i] = new Vehicle(sn, pc);
break;
case car:
++carTotal;
std::cin >> pc;
segment[i] = new Car(sn, pc);
break;
case truck:
++truckTotal;
std::cin >> pc >> dot;
segment[i] = new Truck(sn, pc, dot);
break;
case van:
++vanTotal;
std::cin >> pc >> dot >> d1 >> d2 >> d3;
segment[i] = new Van(sn, pc, dot, d1, d2, d3);
break;
case tanker:
++tankerTotal;
std::cin >> pc >> dot >> d1 >> d2;
segment[i] = new Tanker(sn, pc, dot, d1, d2);
break;
case flatbed:
++flatbedTotal;
std::cin >> pc >> dot >> d1 >> d2;
segment[i] = new Flatbed(sn, pc, dot, d1, d2);
break;
default: // should never get here
std::cerr << "**ERROR: bad serial number passed to decision logic ";
break;
} // end switch
if (segment[i] == 0)
{
std::cerr << "Memory allocation problem.";
break;
} //end if
tonnage += segment[i] -> LoadCapacity();
tolls += segment[i] -> Toll();
}// end for
std::cout << " Segment Summary =============== ";
std::cout << " Cars: " << carTotal;
std::cout << " Trucks: " << truckTotal;
std::cout << " Vans: " << vanTotal;
std::cout << " Tankers: " << tankerTotal;
std::cout << " Flatbeds: " << flatbedTotal;
std::cout << " Unknowns: " << vehicleTotal;
std::cout << " Badsn: " << badSnTotal;
std::cout << std::setprecision(2) << std::fixed;
std::cout << " Tonnage: " << tonnage;
std::cout << " Tolls: $" << tolls << std::endl;
std::cout << " Segment Details =============== ";
std::cout << std::setw(6) << std::right << "Type"
<< std::setw(7) << "Toll"
<< std::setw(10) << "Pass. Cap"
<< std::setw(10) << "Load. Cap"
<< std::setw(13) << "DOT License"
<< std::setw(15) << "Serial Number"
<< std::endl;
std::cout << std::setw(6) << std::right << "----" << std::setw(7) << "----"
<< std::setw(10) << "--------" << std::setw(10) << "--------"
<< std::setw(13) << "-----------" << std::setw(15) << "-------------"
<< std::endl;
for (size_t i = 0; i < sSize; ++i) // segmentation
{
std::cout << std::setw(6) << std::setprecision(2) << std::fixed << std::right
<< std::showpoint << segment[i] -> ShortName()
<< std::setw(7) << segment[i] ->Toll()
<< std::setw(10) << segment[i] -> PassengerCapacity()
<< std::setw(10) << segment[i] -> LoadCapacity();
if (truck <= Vehicle::SnDecode(v->SerialNumber()))
{
std::cout << std::setw(13) << (dynamic_cast<Truck*>(segment[i]))->DOTLicense()<<" ";
}
else
{
std::cout << std::setw(13) << "NA";
std::cout << std::setw(15) << segment[i] ->SerialNumber() << std::endl;
} // end if else
delete segment[i];
} // end for
}//end while
std::cout << " ...Thank you for using SunPass Tracker. ";
}// end of client program
This is some sample output from the program(this executable was made by the professor so this is how it should run)
after executing the program it displays the message tracker started and asks the user to input several numbers, the first one means quantity of vehicles, the second number represents the type of vehicle the third is the passenger capacity and the fourth represents the dot license. There are vehicles such as tankers, flatbeds that can need more information thy need to be inputted 2 values more because these values represent their dimensions to calculate their area and volume of the cylinder in the case of tankers and bed in the case of flatbeds. In the case of vans, they need 3 instead of two more because they need 3 dimensions in order to calculate their volume. this cycle may repeat depending on the quantity of vehicles that cross the highway. The program ends when the user inputs a noninteger. thanks for your help.
RCL::Tracker started...
1
3
4
5
Segment Summary
===============
Cars: 0
Trucks: 1
Vans: 0
Tankers: 0
Flatbeds: 0
Unknowns: 0
Badsn: 0
Tonnage: 0.00
Tolls: $10.00
Segment Details
===============
Type Toll Pass Cap Load Cap DOT License Serial Number
---- ---- -------- -------- ----------- -------------
TRK 10.00 4 0.00 5 3
4
2
3
4
5
6
3
4
5
3
4
5
4
3
4
6
7
4
Segment Summary
===============
Cars: 1
Trucks: 1
Vans: 2
Tankers: 0
Flatbeds: 0
Unknowns: 0
Badsn: 0
Tonnage: 228.00
Tolls: $32.00
Segment Details
===============
Type Toll Pass Cap Load Cap DOT License Serial Number
---- ---- -------- -------- ----------- -------------
CAR 2.00 3 0.00 (NA) 2
VAN 10.00 5 60.00 6 4
TRK 10.00 4 0.00 5 3
VAN 10.00 3 168.00 4 4
e
** Tracker error: non-integer segment size encountered
...Thank you for using SunPass Tracker.
Explanation / Answer
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 and an object-oriented vehicle counter for use by the Department of Transportation (DOT).
Deliverables: Two (2) files: tracker.cpp, log.txt
Deliverables Note: This project depends on these files delivered with the previous project: vehicles.h, vehicles.cpp, shapes.h, shapes.cpp
Assessment Rubric
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 "client side" of the SunPass project. Using the various DOT Vehicle classes built in the preceding assignment, we build the tracker client program.
Procedural Requirements
Create and work within a separate subdirectory cop3330/proj5. Review the COP 3330 rules found in Introduction/Work Rules.
Begin by copying the following files from the course home: into your proj5 directory:
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.
Begin a log file named log.txt. This should be an ascii text file in cop3330/proj5 with the following header:
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.
Begin by copying the various shapes and vehicles fils from the preceding project: shapes.h, shapes.cpp, vehicles.h, and vehicles.cpp. Be sure that these files remain identical to those from the preceding project.
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.
Turn in the files vehicles.h, vehicles.cpp, shapes.h, shapes.cpp, tracker.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 - Client Side
You are to implement a client program tracker of the vehicle system described above.
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 tracker processing loop continues until zero is read for a segment 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 passenger capacity pc. For all specific truck types, the next entry will be the DOTlicense DOTL followed by the dimension data d1 d2 d3(optional). For example, a car, truck, van, tanker, and flatbed would have these lines of data:
The dimensional data should be interpreted in the order d1 = length, d2 = width or radius, d3 = height. Note that this is more or less self-documenting in the data file segment0.data. Note also that we will assume that each vehicle and its data are in a separate line of the input file.
Tracker should instantiate the objects of a segment using an array whose elements are of type Vehicle *, that is, pointer to type Vehicle. At the end of reading the segment data, this array should have pointers to vehicle objects representing the entire segment. 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 segment 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. The distributed makefile should create separate object files vehicles.o, shapes.o , andtracker.o and then create the executable tracker.x.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.