Question: Hi, can you please help me with C++ classes question? Will rate! Thanks. date.cpp file -------------------------------------------------------------------------------------------- #include #include date.hpp Date::Date(int d, int m, int y){

Hi, can you please help me with C++ classes question? Will rate! Thanks.

Hi, can you please help me with C++ classes question? Will rate!

date.cpp file --------------------------------------------------------------------------------------------

#include

#include "date.hpp"

Date::Date(int d, int m, int y){

day = d;

month = m;

year = y;

}

int Date::getDay(){

return day;

}

int Date::getMonth(){

return month;

}

int Date::getYear(){

return year;

}

Date::~Date(){

}

date.h file --------------------------------------------------------------------------------------------

#ifndef DATE_H

#define DATE_H

#include

using namespace std;

class Date{

private:

int day, month, year;

public:

Date(int d, int m, int y);

int getDay();

int getMonth();

int getYear();

~Date();

};

#endif

vehicle.cpp file --------------------------------------------------------------------------------------------

#include

#include "vehicle.hpp"

using namespace std;

Vehicle::~Vehicle(){

}

Vehicle::Vehicle(const char * m, Date *fDate, int mAge, const char * id){

model = m;

fleetDate = fDate;

mileage = mAge;

vehicle_id = id;

for (int i = 0; i

for (int j = 0; j

availability[i][j] = true;

}

}

}

const char * Vehicle::getModel(){

return model;

}

Date * Vehicle::getFleetDate(){

return fleetDate;

}

int Vehicle::getMileage(){

return mileage;

}

const char * Vehicle::getVehicleId(){

return vehicle_id;

}

void Vehicle::book(int day, int month){

availability[month][day] = false;

}

bool Vehicle::isBook(int day, int month){

return !availability[month][day];

}

void Vehicle::print(){

cout

cout getDay()

getMonth() getYear()

cout

cout

}

vehicle.h file --------------------------------------------------------------------------------------------

#ifndef VEHICLE_H

#define VEHICLE_H

#include "date.hpp"

class Vehicle{

private:

const char* model;

Date *fleetDate;

int mileage;

const char* vehicle_id;

bool availability[12][30];

public:

Vehicle(const char* m, Date *fDate, int mileage, const char* vehicle_id);

const char* getModel();

Date *getFleetDate();

int getMileage();

const char* getVehicleId();

void book(int day, int month);

bool isBook(int day, int month);

void print();

~Vehicle();

};

#endif

car.cpp file --------------------------------------------------------------------------------------------

#include

#include "car.hpp"

using namespace std;

Car::Car(const char * m, Date * fDate, int mAge, const char * id, int pCapacity):Vehicle(m, fDate, mAge, id){

passengerCapacity = pCapacity;

}

Car::~Car(){

}

int Car::getCapacity(){

return passengerCapacity;

}

void Car::print(){

Vehicle::print();

cout

cout

}

car.h file --------------------------------------------------------------------------------------------

#ifndef CAR_H

#define CAR_H

#include "vehicle.hpp"

#include "date.hpp"

class Car :

public Vehicle{

private:

int passengerCapacity;

public:

Car(const char *m, Date *fDate, int mileage, const char* vehicle_id, int pCapacity);

~Car();

int getCapacity();

void print();

};

#endif

truck.cpp file --------------------------------------------------------------------------------------------

#include

#include "truck.hpp"

using namespace std;

Truck::Truck(const char * m, Date * fDate, int mAge, const char * id, int limit):Vehicle(m, fDate, mAge, id){

weightLimit = limit;

}

Truck::~Truck(){

}

int Truck::getWeightLimit(){

return weightLimit;

}

void Truck::print(){

Vehicle::print();

cout

cout

}

truck.h file --------------------------------------------------------------------------------------------

#ifndef TRUCK_H

#define TRUCK_H

#include "vehicle.hpp"

class Truck :

public Vehicle{

private:

int weightLimit;

public:

Truck(const char *m, Date *fDate, int mAge, const char* id, int limit);

~Truck();

int getWeightLimit();

void print();

};

#endif

test.cpp file --------------------------------------------------------------------------------------------

#include

#include "date.hpp"

#include "car.hpp"

#include "truck.hpp"

using namespace std;

int main(){

//enter date of join for Car and Truck

Date d1(8,10,2016), d2(12,21,2015);

//model, vehicle mileage, ID, passenger capacity of Car

// &d1 is the constructor for initialization of 'Car'

Car car("Toyota", &d1, 200, "3456", 6);

//model, mileage, ID, weight limit of Truck

//&d2 is the constructor for initialization of 'Truck'

Truck truck("20Wheel", &d2, 150, "7654", 2500);

//prints vehicle type as 'Car' and its passenger limit

car.print();

cout

//prints vehicle type as 'Truck' and it weight limit

truck.print();

cout

return 0;

}

OUTPUT --------------------------------------------------------------------------------------------

Vehicle Model: Toyota

Date of join to the fleet: 8/10/2016

Vehicle Mileage: 200

Vehicle ID: 3456

Vehicle Type: Car

Passenger Capacity: 6

Vehicle Model: 20Wheel

Date of join to the fleet: 12/21/2015

Vehicle Mileage: 150

Vehicle ID: 7654

Vehicle Type: Truck

Weight Limit: 2500kg

Program ended with exit code: 0

Please use C++ Below are classes Date, Vehicle, Car and Truck. Your job is to create classes Customer and ReservationRequest. Include one or more constructors, destructor and the necessary set and get functions for each class. Also, provide a print function for each class which outputs all the data members of that class. (a) Define a class Customer with the following data members: The name of the customer as a standard library string. The driving license of the customer as a library string. . The date of birth of the customer (use Date class) (b) Define a class ReservationRequest with the following data members, A customer object from part (a). A library string as the vehicle_type which is either "car" or "truck". .An integer counter that generates reservation request numbers. An integer as a reservation request number. The counter is incremented by one each time a reservation request object is created, then this value is assigned as the reservation request number. Reservation date from part (use Date class). The starting date of the rental from part (use Date class). The end date of the rental from part (use Date class). . An integer for passenger capacity of the requested car or weight limit of the truck. Once classes are created, don't forget to update test.cpp file. DELIVERABLES: customer.cpp, customer.h, reservationrequest.cpp, reservationrequest.h, updatedtest.cpp

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!