-
Notifications
You must be signed in to change notification settings - Fork 3.4k
/
Copy pathRide.hpp
51 lines (44 loc) · 1.04 KB
/
Ride.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
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef RIDE_HPP
#define RIDE_HPP
#include <string>
#include <ctime>
#include "User.hpp"
#include "Location.hpp"
enum class RideStatus {
REQUESTED,
ACCEPTED,
IN_PROGRESS,
COMPLETED,
CANCELLED
};
class Ride {
private:
std::string rideId;
User* rider;
User* driver;
Location* pickup;
Location* dropoff;
double distance;
double fare;
std::time_t requestTime;
std::time_t completionTime;
RideStatus status;
public:
Ride(std::string rideId, User* rider, Location* pickup, Location* dropoff);
~Ride();
std::string getRideId() const;
User* getRider() const;
User* getDriver() const;
Location* getPickup() const;
Location* getDropoff() const;
double getDistance() const;
double getFare() const;
std::time_t getRequestTime() const;
std::time_t getCompletionTime() const;
RideStatus getStatus() const;
void assignDriver(User* driver);
void calculateFare();
void updateStatus(RideStatus status);
void displayInfo() const;
};
#endif