-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrip.hpp
38 lines (37 loc) · 1.22 KB
/
trip.hpp
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
#pragma once
#include "rider.hpp"
#include "driver.hpp"
#include "pricingStrategy.hpp"
#include "driverMatchingStrategy.hpp"
class Trip {
Rider* rider;
Driver* driver;
Location* srcloc;
Location* dstLoc;
TRIP_STATUS status;
int tripId;
double price;
PricingStrategy* pricingStrategy;
DriverMatchingStrategy* driverMatchingStrategy;
public:
Trip(Rider* pRider, Driver* pDriver, Location* pSrcLoc, Location* pDstLoc, double pPrice,
PricingStrategy* pPricingStrategy, DriverMatchingStrategy* pDriverMatchingStrategy) :
rider(pRider), driver(pDriver), srcloc(pSrcLoc), dstLoc(pDstLoc), price(pPrice),
pricingStrategy(pPricingStrategy), driverMatchingStrategy(pDriverMatchingStrategy) {
status = TRIP_STATUS::DRIVER_ON_THE_WAY;
//This is not threadsafe and is just for demo purposes
tripId = nextTripId;
nextTripId++;
}
int getTripId() {
return tripId;
}
void displayTripDetails() {
cout << endl;
cout << "Trip id - " << tripId << endl;
cout << "Rider - " << rider->getRiderName() << endl;
cout << "Driver - " << driver->getDriverName() << endl;
cout << "Price - " << price << endl;
cout << "Locations - " <<srcloc->latitude<<","<<srcloc->longitude<<" and "<<dstLoc->latitude<<","<<dstLoc->longitude << endl;
}
};