add solution of hw2

This commit is contained in:
JamesFlare1212
2025-01-23 06:14:30 -05:00
parent b638fdea68
commit a5667d5026
9 changed files with 678 additions and 26 deletions

62
hws/ride_sharing/Rider.h Normal file
View File

@@ -0,0 +1,62 @@
#ifndef __RIDER_H
#define __RIDER_H
#include <string>
class Rider {
private:
std::string firstName;
std::string lastName;
std::string gender;
int age;
std::string phoneNumber;
double rating;
std::string pickupLocationName;
double pickupLatitude;
double pickupLongitude;
std::string dropoffLocationName;
double dropoffLatitude;
double dropoffLongitude;
std::string vehiclePref;
std::string currentState;
//driver's info
std::string driverFirstName;
std::string driverLastName;
std::string driverPhoneNumber;
public:
//init
Rider();
Rider(const std::string &fName, const std::string &lName,
const std::string &gen, int a, const std::string &phone,
double r, const std::string &pickupLocName, double pickupLat, double pickupLon,
const std::string &dropoffLocName, double dropoffLat, double dropoffLon,
const std::string &vehiclePref, const std::string &state,
const std::string &dF, const std::string &dL, const std::string &dP);
//getters & setters
const std::string& getFirstName() const;
const std::string& getLastName() const;
const std::string& getGender() const;
int getAge() const;
const std::string& getPhoneNumber() const;
double getRating() const;
const std::string& getPickupLocationName() const;
double getPickupLatitude() const;
double getPickupLongitude() const;
const std::string& getDropoffLocationName() const;
double getDropoffLatitude() const;
double getDropoffLongitude() const;
const std::string& getVehiclePref() const;
const std::string& getCurrentState() const;
const std::string& getDriverFirstName() const;
const std::string& getDriverLastName() const;
const std::string& getDriverPhoneNumber() const;
void setCurrentState(const std::string &state);
void setDriverInfo(const std::string &df, const std::string &dl, const std::string &dp);
//return a string representation of the rider
std::string toFileString() const;
};
#endif