Problem statement
Assume that Best Transport Pte Ltd is a small company that specializes in transporting
people and moving goods. It has an extensive fleet of vehicles consisting of mini buses,
buses and Lorries. Transport services are charged either on an hourly rate or per trip,
based on the vehicle capacity.
The fleet of vehicles available and charges for each vehicle type are shown in the table
below.
Vehicle Type Capacity Charges Number of vehicles available
Mini Bus--------15-----80 per hour ----------5
Bus ------------ 30-----120 per hour ---------2
Small Lorry-10'x5'x12'-200 per trip ---------2
Large Lorry-16'x6'x15'-300 per trip ---------2
Write a program that allows the administrator to confirm bookings of vehicles for a
particular day. When the program is invoked, the administrator can view the list of
vehicles available, and select one for booking. The administrator can then key in the total
number of hours or total number of trips, respectively, based on the charge type. The
system will then calculate and display the total transport charge, and mark the vehicle as
booked and no longer available for the day. The administrator should also be allowed to
display the complete list of vehicles in the fleet, their status (booked or available) and the
booking details, if booked.
Design and implement a class VehicleInfo in your program. The VehicleInfo class will
contain the vehicleID, vehicleType and vehicleCapacity. Two derived classes BusInfo
and LorryInfo will inherit from VehicleInfo class. BusInfo will contain vehicleCapacity
in terms of number of passengers allowed, and services are charged on an hourly rate.
LorryInfo will contain the length, breadth and height of the boxed lorry and services are
charged based on the number of trips. You will need to keep track of other data such as
the booking status, and the total charges.
You are required to exercise creativity in your program design and may add other
features such as special discounts. You should make your program as friendly as
possible to the users.
================================================================================
This is what we have!
We are stuck PLEASE HELP US PLEASE!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
//============================================================================
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
//=============================================================================
class VehicleInfo //classes
{
protected:
string vehicleID;
string vehicleType;
int vehicleCapacity;
public:
void vehicleID();
void vehicleType();
void vehicleCapacity();
};
class Record : protected VehicleInfo // declaring info for booking name, identification, telephone
{
protected:
char F_name[2];
string Day;
int Time;
string NRIC;
int status;
string p_name;
string IC_no;
int Tele_no;
string temp;
};
class Book : protected Record
{
private:
ifstream fin;
ofstream fout;
protected:
string name;
string day;
int time;
public:
void book();
void availability();
void enquire();
};
class BusInfo: public VehicleInfo
{
void vehicleID();
void vehicleType();
void vehicleCapacity();
void busCharges();
};
class LorryInfo: public VehicleInfo
{
void vehicleID();
void vehicleType();
void vehicleCapacity();
void lorryCharges();
};
//=======================================================================================
void VehicleInfo::vehicleID(void)//Function Vehicle ID
{
cout<<"Your Vehicle ID is: "<<endl;
ifstream infile;
infile.open("BookingRecord.txt");
if(infile==0)
cout<<"Sorry no Records found"<<endl;
infile.seekg(72)
}
void VehicleInfo::vehicleType(void)//Function vehicle type
{
int type;
int bustype;
int lorrytype;
cin.get();
cout << "bus or lorry?" <<endl;
cout << "1. Bus"<<endl;
cout<< " 2. Lorry"<<endl;
cin>>type;
if(type==1)
{ cout<<" Which bus type you want?"<<endl;
cout<<" 1. Mini Bus"<<endl;
cout<<" 2. Bus"<<endl;
cin>>bustype;
if(bustype==1)
cout<<"You have chosen Minibus"<<endl;
if(bustype==2)
cout<<"You have chosen Bus"<<endl;
else
cout<<"Invalid choice"<<endl;
}
if(type==2)
{ cout<<" Which type of of lorry do you want"<<endl;
cout<<" 1. Small"<<endl;
cout<<" 2. Large"<<endl;
cin>>lorrytype;
if(lorrytype==1)
cout<<"You have chosen Small Lorry"<<endl;
if(bustype==2)
cout<<"You have chosen Large Lorry"<<endl;
else
cout<<"Invalid choice"<<endl;
}
}
void VehicleInfo::busCharges()
{
infile.open(
|