CSCE Homework Help
EagleLyft/.DS_Store
__MACOSX/EagleLyft/._.DS_Store
EagleLyft/a.out
EagleLyft/driver.cpp
#include <iostream> #include <string> #include <cstdlib> using namespace std; #include "driver.h"//including the driver header file Driver::Driver()//default constructor { ID = 0; fname = ""; lname = ""; vehicle_cap =0; handicap_capable = ""; vehicle_type = ""; driver_rating = 0.0; availability = ""; pets_allowed = ""; notes = ""; } Driver::Driver(int ID, string fname, string lname, int vehicle_cap, bool handicap_capable, string vehicle_type, float driver_rating,bool availability, bool pets_allowed, string notes) {//parameterized constructor ID = ID; fname = fname; lname = lname; vehicle_cap = vehicle_cap; handicap_capable = handicap_capable; vehicle_type = vehicle_type; driver_rating = driver_rating; availability = availability; pets_allowed = pets_allowed; notes = notes; } //mutators functions void Driver::setID(int ID) { this->ID=ID; } void Driver::setFname(string fname) { this->fname = fname; } void Driver::setLname(string lname) { this->lname = lname; } void Driver:: setVehicle_cap(int vehicle_cap) { this->vehicle_cap = vehicle_cap; } void Driver:: setHandicap_capable(bool handicap_capable) { this->handicap_capable = handicap_capable; } void Driver:: setVehicle_type(string vehicle_type) { this->vehicle_type =vehicle_type; } void Driver:: setDriver_rating(float driver_rating) { this->driver_rating = driver_rating; } void Driver:: setAvailability(bool availability) { this->availability = availability; } void Driver:: setPets_allowed(bool pets_allowed) { this->pets_allowed = pets_allowed; } void Driver:: setNotes(string notes) { this->notes = notes; } //accessor functions int Driver::getID() { return ID; } string Driver::getFname() { return fname; } string Driver::getLname() { return lname; } int Driver:: getVehicle_cap() { return vehicle_cap; } bool Driver:: getHandicap_capable() { return handicap_capable; } string Driver:: getVehicle_type() { return vehicle_type; } float Driver:: getDriver_rating() { return driver_rating; } bool Driver:: getAvailability() { return availability; } bool Driver:: getPets_allowed() { return pets_allowed; } string Driver:: getNotes() { return notes; }
__MACOSX/EagleLyft/._driver.cpp
EagleLyft/driver.h
#ifndef DRIVER_H_ #define DRIVER_H_ #include <string> using namespace std; class Driver//creating a class named driver { private: int ID;//declaring driver id string fname;//declaring driver first name string lname;//declaring driver last name int vehicle_cap;//declaring vehicle capacity bool handicap_capable;//declaring if it is handicap capable or not string vehicle_type;//declaring vehicle type float driver_rating;//declaring driver rating bool availability;//declaring availability bool pets_allowed;//declaring the pets allowed option string notes;//declaring notes public: Driver();//default constructor Driver(int, string, string, int, bool, string, float,bool, bool, string); // parameterized constructor //mutator functions void setID(int); void setFname(string); void setLname(string); void setVehicle_cap(int); void setHandicap_capable(bool); void setVehicle_type(string); void setDriver_rating(float); void setAvailability(bool); void setPets_allowed(bool); void setNotes(string); //accessor functions int getID(); string getFname(); string getLname(); int getVehicle_cap(); bool getHandicap_capable(); string getVehicle_type(); float getDriver_rating(); bool getAvailability(); bool getPets_allowed(); string getNotes(); }; #endif
__MACOSX/EagleLyft/._driver.h
EagleLyft/drivers.cpp
#include <iostream> #include <string> #include <vector> #include <cstdlib> #include <stdlib.h> #include <time.h> using namespace std; #include "drivers.h"//including drivers header file #include "driver.h"//include driver header file #include "rides.h"//including rides header file #include "ride.h" //include ride header file extern Rides myrides; //including object of Rides class Drivers::Drivers()//default constructor { driver_count = 0; } int Drivers::getCount() { return driver_count; } void Drivers::inccount() { driver_count++; } void Drivers::deccount() { if (driver_count != 0) driver_count--; } void Drivers::add_driver()//function for adding driver { int id; string fname; string lname; int capacity; int handicapped; string type; float rating; int available; int pets; string notes; Driver* tempobj; tempobj = new Driver; cout << " Enter ID Number: " << endl; cin >> id; tempobj->setID(id); cin.ignore(); cout << " Enter First Name: " << endl; cin >> fname; tempobj->setFname(fname); cin.ignore(); cout << " Enter Last Name: " << endl; cin >> lname; tempobj->setLname(lname); cout << " Enter Vehicle Capacity: " << endl; cin >> capacity; tempobj->setVehicle_cap(capacity); cout << " Handicap Capable?(1 for Yes or 0 for No): " << endl; cin >> handicapped; tempobj->setHandicap_capable(handicapped); cin.ignore(); cout << " Enter Vehicle type: " << endl; cin >> type; tempobj->setVehicle_type(type); cout << " Enter Driver Rating: " << endl; cin >> rating; tempobj->setDriver_rating(rating); cout << " Availability?(1 for Yes or 0 for No): " << endl; cin >> available; tempobj->setAvailability(available); cout << " Are Pets Allowed?(1 for Yes or 0 for No): " << endl; cin >> pets; tempobj->setPets_allowed(pets); cin.ignore(); cout << " Enter Notes: " << endl; getline(cin, notes); tempobj->setNotes(notes); DriversList.push_back(*tempobj); inccount(); } void Drivers::delete_driver()//function for deleting driver { int id; cout << " Enter the Driver ID to delete: "; cin >> id; for (int i = 0; i < DriversList.size(); i++) { if (DriversList.at(i).getID() == id) { DriversList.erase(DriversList.begin() + i); cout << " Driver's Information" << id << " deleted sucessfully!!" << endl; deccount(); return; } } cout << " Driver's Information not found!" << endl; } void Drivers::search_driver()//function for searching driver { int a; cout << " Enter Driver ID: "; cin >> a; cout << endl; for (int i = 0; i < DriversList.size(); i++) { if (DriversList.at(i).getID() == a) { cout << " Driver information Found!!" << endl << endl; cout << " Driver ID: " << DriversList.at(i).getID() << endl; cout << " Driver Name: " << DriversList.at(i).getFname() << " " << DriversList.at(i).getLname()<< endl; cout << " Vehicle Capacity: " << DriversList.at(i).getVehicle_cap() << endl; cout << " Handicapped capable: " << DriversList.at(i).getHandicap_capable() << endl; cout << " Vehicle Type: " << DriversList.at(i).getVehicle_type() << endl; cout << " Driver Rating: " << DriversList.at(i).getDriver_rating() << endl; cout << " Driver Availability: " << DriversList.at(i).getAvailability() << endl; cout << " Pets Allowed: " << DriversList.at(i).getPets_allowed() << endl; cout << " Notes: " << DriversList.at(i).getNotes() << endl << endl; return; } } cout << " Driver's Information Not Found!!" << endl; } void Drivers::edit_driver()//function for editing driver { int a; int id; string fname; string lname; int capacity; bool handicapped; string type; float rating; bool available; bool pets; string notes; int driver_info; cout << " Enter the ID of driver you want to Edit: "; cin >> a; for (int i = 0; i < DriversList.size(); i++) { if (DriversList.at(i).getID() == a) { cout << " Enter new ID Number: " << endl; cin >> id; DriversList.at(i).setID(id); cout << " Enter new First Name: " << endl; cin >> fname; cin.ignore(); DriversList.at(i).setFname(fname); cout << " Enter new Last Name: " << endl; cin >> lname; cin.ignore(); DriversList.at(i).setLname(lname); cout << " Enter new Vehicle Capacity: " << endl; cin >> capacity; DriversList.at(i).setVehicle_cap(capacity); cout << " Enter new Handicapped Capable: " << endl; cin >> handicapped; DriversList.at(i).setHandicap_capable(handicapped); cout << " Enter new Vehicle type: " << endl; cin >> type; cin.ignore(); DriversList.at(i).setVehicle_type(type); cout << " Enter new Driver Rating: " << endl; cin >> rating; DriversList.at(i).setDriver_rating(rating); cout << " Enter new Availability: " << endl; cin >> available; DriversList.at(i).setAvailability(available); cout << " Enter new Pets Allowed: " << endl; cin >> pets; DriversList.at(i).setPets_allowed(pets); cout << " Enter new Notes: " << endl; cin >> notes; DriversList.at(i).setNotes(notes); cout << " Driver's Information" << DriversList.at(i).getID() << " sucessfully edited!!" << endl; return; } } cout << " Driver's Information not found!" << endl; } void Drivers::print_driverlist ()//printing the driver list { for (int i = 0; i < DriversList.size(); i++) { cout << " Driver ID: " << DriversList.at(i).getID() << endl; cout << " Driver Name: " << DriversList.at(i).getFname() << " " << DriversList.at(i).getLname()<< endl; cout << " Vehicle Capacity: " << DriversList.at(i).getVehicle_cap() << endl; cout << " Handicapped capable: " << DriversList.at(i).getHandicap_capable() << endl; cout << " Vehicle Type: " << DriversList.at(i).getVehicle_type() << endl; cout << " Driver Rating: " << DriversList.at(i).getDriver_rating() << endl; cout << " Driver Availability: " << DriversList.at(i).getAvailability() << endl; cout << " Pets Allowed: " << DriversList.at(i).getPets_allowed() << endl; cout << " Notes: " << DriversList.at(i).getNotes() << endl << endl; } cout << " End of the List!" << endl << endl; } void Drivers::print_driver()//printing a particular driver info { int b; cout << " Enter the ID of the Driver's information you want to Print: "; cin >> b; for (int i = 0; i < DriversList.size(); i++) { if (DriversList.at(i).getID() == b) { cout << " Driver information Found!!" << endl << endl; cout << " Driver ID: " << DriversList.at(i).getID() << endl; cout << " Driver Name: " << DriversList.at(i).getFname() << " " << DriversList.at(i).getLname()<< endl; cout << " Vehicle Capacity: " << DriversList.at(i).getVehicle_cap() << endl; cout << " Handicapped capable: " << DriversList.at(i).getHandicap_capable() << endl; cout << " Vehicle Type: " << DriversList.at(i).getVehicle_type() << endl; cout << " Driver Rating: " << DriversList.at(i).getDriver_rating() << endl; cout << " Driver Availability: " << DriversList.at(i).getAvailability() << endl; cout << " Pets Allowed: " << DriversList.at(i).getPets_allowed() << endl; cout << " Notes: " << DriversList.at(i).getNotes() << endl << endl; return; } } cout << " Driver's Information Not Found!!" << endl; }
__MACOSX/EagleLyft/._drivers.cpp
EagleLyft/drivers.h
#include "driver.h"//including the driver header file class Drivers//creating a class named Drivers { private: int driver_count; vector <Driver> DriversList;//creating a vevtor public: Drivers();//default constructor //functions to find information about the driver void search_driver(); void add_driver(); void edit_driver(); void delete_driver(); int getCount(); void inccount(); void deccount(); void print_driverlist(); void print_driver(); };
__MACOSX/EagleLyft/._drivers.h
EagleLyft/eaglemain.cpp
#include <iostream> #include <string> #include <time.h> #include <vector> #include "driver.h"//including driver header file #include "passenger.h"//including passenger header file #include "ride.h"//including ride headerfile #include "drivers.h"//including drivers header file #include "passengers.h"//including passengers header file #include "rides.h"//including driver rides file using namespace std; int main() { //creating object for different class Drivers mydriver; Passengers mypassenger; Rides myrides; int num;//declaring an integer int option;//declaring an integer string choose;//declaring a string top://printing the main menu cout << endl; cout << " **** G O M E A N G R E E N **** " << endl; cout << " **** MEAN GREEN EAGLE LYFT SYSTEM MENU ****" << endl; cout << endl << " Please Select Operation Type " << endl; cout << " ---------------------------- " << endl << endl; cout << " 1 - D R I V E R" << endl; cout << " 2 - P A S S E N G E R" << endl; cout << " 3 - R I D E" << endl; cout << " 0 - Q U I T" << endl << endl; cout << endl << " Please Enter your choice: "; //asking user for an option cin >> num; cout << endl; if (num == 1) {//printing the driver's menu cout << " --- DRIVER OPERATION --- "<< endl; cout << " 1 - Add Driver" << endl; cout << " 2 - Delete Driver" << endl; cout << " 3 - Edit Driver" << endl; cout << " 4 - Print Drivers List" << endl; cout << " 5 - Print Driver Details" << endl; cout << " 6 - Main Menu" << endl; cout << endl << " Please Enter your selection: "; cin >> option; cout << endl; switch (option) { case 1: mydriver.add_driver(); break; case 2: mydriver.delete_driver(); break; case 3: mydriver.edit_driver(); break; case 4: mydriver.print_driverlist(); break; case 5: mydriver.print_driver(); break; case 6: goto top; break; default: { cout << " You've entered an invalid choice.Please try again..." << endl; break; } } } else if (num == 2) {//printing the passenger's menu cout << " --- PASSENGER OPERATION --- "<< endl; cout << " 1 - Add Passenger" << endl; cout << " 2 - Delete Passenger" << endl; cout << " 3 - Edit Passenger" << endl; cout << " 4 - Search Passenger" << endl; cout << " 5 - Print Passenger Details" << endl; cout << " 6 - Print Passengers List" << endl; cout << " 7 - Main Menu" << endl; cout << endl << " Please Enter your selection: "; cin >> option; cout << endl; switch (option) { case 1: mypassenger.add_passenger(); break; case 2: mypassenger.delete_passenger(); break; case 3: mypassenger.edit_passenger(); break; case 4: mypassenger.search_passenger(); break; case 5: mypassenger.print_passengerSearch(); break; case 6: mypassenger.print_passengerList(); break; case 7: goto top; break; default: { cout << " You've entered an invalid choice.Please try again..." << endl; break; } break; } } else if (num == 3) {//printing the ride menu cout << " --- RIDE OPERATION --- "<< endl; cout << " 1 - Add Ride" << endl; cout << " 2 - Delete Ride" << endl; cout << " 3 - Edit Ride" << endl; cout << " 4 - Print a Ride" << endl; cout << " 5 - Print All Rides" << endl; cout << " 6 - Print a Ride Schedule" << endl; cout << " 7 - Update Rides" << endl; cout << " 8 - Main Menu" << endl; cout << endl << " Please Enter your selection: "; cin >> option; cout << endl; switch (option) { case 1: myrides.add_ride(); break; case 2: myrides.delete_ride(); break; case 3: myrides.edit_ride(); break; case 4: { cout << " Please Enter a Ride Number to print "; int a; cin >> a; cin.ignore(); myrides.print_Ride(a); break; } case 5: myrides.print_allRides(); break; case 6: { cout << " Please Enter the Vehicle ID: " << endl; int lis; cin >> lis; cin.ignore(); myrides.print_ridesSchedule(lis); break; } case 7: myrides.updateRide(); break; case 8: goto top; break; default: { cout << " You've entered an invalid choice.Please try again..." << endl; break; } } } else if (num == 0) {//checking if user entered 0 or not and if entered 0, printing the output cout<<" Thank you for using Mean Green Eagle LYFT system!" << endl; cout << " You have a Wonderful Day!!" << endl << endl; return 1; } else { cout << " Invalid Choice!" << endl << endl; goto top; } cout << endl <<" Do you want to continue?(Y/N): ";//asking the user to continue or not cin >> choose; if (choose == "Y" || choose == "y") { cout << endl; goto top; } else { cout<<" Thank you for using Mean Green Eagle LIFT system!!" << endl; } return 0; }
__MACOSX/EagleLyft/._eaglemain.cpp
EagleLyft/Makefile
output: eaglemain.o driver.o passenger.o ride.o drivers.o passengers.o rides.o g++ eaglemain.o driver.o passenger.o ride.o drivers.o passengers.o rides.o -o output eaglemain.o: eaglemain.cpp g++ -c eaglemain.cpp driver.o: driver.cpp driver.h g++ -c driver.cpp passenger.o: passenger.cpp passenger.h g++ -c passenger.cpp ride.o: ride.cpp ride.h g++ -c ride.cpp drivers.o: drivers.cpp drivers.h g++ -c drivers.cpp passengers.o: passenger.cpp passenger.h g++ -c passengers.cpp rides.o: rides.cpp rides.h g++ -c rides.cpp clean: rm *.o output
__MACOSX/EagleLyft/._Makefile
EagleLyft/Mean Green EagleLift System.pdf
Mean Green EagleLift System
Assignment: Homework 2 Course: CSCE 1040 Date: 02-16-2020
Name: Nischal Tiwari Professor: Dr. David Keathley
Class Relationships
Collects Collects Collects
Pickups Contains
Class Contents
Drivers Passengers Rides
Driver Passenger Ride
Driver
ID (int)
First Name (char)
Last Name (char)
Vehicle Capacity (int)
Handicap Check (bool)
Vehicle Type (char)
Driver Rating (float)
Availability (bool)
Pets Allowed (bool)
Notes (string)
Set/get ID
Set/get First Name
Set/get Last Name
Set/get Vehicle Capacity
Set/get Handicap Check
Set/get Vehicle Type
Set/get Driver Rating
Set/get Availability
Set/get Pets Allowed
Set/get Notes
Passenger Name (string)
ID (int)
Payment (char)
Handicap Check (bool)
Rating (float)
Pets (bool)
Set/get Name
Set/get ID
Set/get Payment
Set/get Handicap Check
Set/get Rating
Set/get Pets
Ride
Ride ID (int)
Pickup Location (string)
Pickup Time (string)
Drop-off Location (string)
Size of Party (int)
Includes Pets (bool)
Drop-off Time (int)
Ride Status (char)
Rating (float)
Set/get Ride ID
Set/get Pickup Location
Set/get Pickup Time
Set/get Drop-off Location
Set/get Size of Party
Set/get Includes Pets
Set/get Drop-off Time
Set/get Ride Status
Set/get Rating
Function Pseudo Code: Add Driver Prompt user for ID Prompt user for First Name Prompt user for First Name Prompt user for Vehicle Capacity Prompt user for Handicapped Check Prompt user for Vehicle Type Prompt user for Availability Prompt user for Pets Policy Prompt user for Notes Create Driver Object Populate Driver Object Add object to collection
Edit/Delete Driver Prompt user for Driver ID Search the driver by ID
If it matches drivers ID
Drivers
Count (int)
Driverslist (vector)
Add Driver
Edit Driver
Delete Driver
Search Driver
Print Driverlist
Print Details (all)
Print Search Driver
Passengers
Count (int) Passengerslist (vector) Add Passenger Edit Passenger Delete Passenger Print Passengerslist Print Entries
Rides
Count (int)
Rideslist (vector)
Add Ride
Edit Ride
Delete Ride
Search Ride
Print Rideslist
Print Search Ride
Print Status
Print Rides (Passenger,
Driver)
Print details Prompt user for Edit or Delete
If they want to Edit Print Driver’s details and Prompt user for editing details If they want to Delete
Prompt user for confirmation Populate and update the details to Driver object
Add Passenger Prompt user for Name Prompt user for ID Prompt user for Payment Preference Prompt user for Handicapped Prompt user for Rating required Prompt user for Pets Create Passenger object Populate Passenger object Add object to collection
Edit/Delete Passenger Prompt user for Passenger ID Search the passenger by ID
If the search matches ID Print the details Prompt user for Edit or Delete If they want to Edit Print Passenger details and Prompt user for editing details If they want to Delete Prompt user for confirmation Populate object Update the details to the Passenger object
Add Ride Auto-assign Ride ID Prompt user for Pickup Location Prompt user to select the Driver Prompt user for Pickup Time
If the time entered by passenger is not available Print and Prompt user to select a different option; Re-enter the time for pickup Select a different Driver
Prompt user for Drop-off Location Prompt user for Size of Party
If the Size of Party entered by the user is not valid Print and Prompt user to select a different option; Re-enter the size of party Select a different Driver
Prompt user for Pets If Pets entered not available or valid Print and Prompt user to select a different option; Enter the value again Select a different Driver
Print if the selected driver has handicapped capability If the handicapped capability is not available according to the passenger’s preference Prompt the passenger to select a different driver
Create the Ride object Populate the Ride object Add object to collection
Edit/Delete Ride Prompt user for Ride ID Search Ride by ID
If the ride matches the ID Print details for the ride
Prompt user for Edit or Delete If they want to Edit Print the ride details and Prompt user for editing the details If they want to Delete Prompt user for confirmation
Update the details to the Ride object
Complete Ride Prompt user for the Ride ID Prompt user for the Passenger ID Prompt user for completion Find ride by ride ID Search ride by Passenger ID Search all ride by both ID
If they both matches Print details for the completed ride
Prompt user for drop-off time Prompt user for rating Populate the object Update details to the Ride object
Cancel Ride Prompt user for Ride ID Prompt user for Passenger ID Prompt user for cancellation Find ride by ride ID Search ride by Passenger ID Search all rides by both ID
If they both matches Print details
Prompt user for confirmation Update details to the ride object
Print Rides for particular Passenger Prompt user for the Passenger name Prompt user for the Passenger ID Find Rides by Name Search all rides (by Passenger ID)
If passenger ID matches Print ride details
Print Rides for particular Driver Prompt user for the Driver name Prompt user for the Driver ID Find rides by Name Search all rides (by Driver ID)
If driver ID matches Print ride details
Print Rides by Status Prompt user to choose status (Active, Completed and Cancelled) Search all by status
If matches Print the detail
__MACOSX/EagleLyft/._Mean Green EagleLift System.pdf
EagleLyft/passenger.cpp
#include "passenger.h"//including passenger header file #include <iostream> #include <string> using namespace std; Passenger::Passenger()//default constructor { name = ""; p_ID = 0; payment = ""; handicap_check = ""; p_rating = 0.0; pet_check = ""; } Passenger::Passenger(string name, int p_ID, string payment,bool handicap_check,float p_rating, bool pet_check) {//parameterized constructor name = name; p_ID = p_ID; payment = payment; handicap_check = handicap_check; p_rating = p_rating; pet_check = pet_check; } //mutator functions void Passenger::setName(string name) { this->name = name; } void Passenger::setP_ID(int p_ID) { this->p_ID = p_ID; } void Passenger::setPayment(string payment) { this->payment = payment; } void Passenger:: setHandicap_check(bool handicap_check) { this->handicap_check = handicap_check; } void Passenger:: setP_rating(float p_rating) { this->p_rating = p_rating; } void Passenger:: setPet_check(bool pet_check) { this->pet_check = pet_check; } //accessor functions string Passenger::getName() { return name; } int Passenger::getP_ID() { return p_ID; } string Passenger:: getPayment() { return payment; } bool Passenger:: getHandicap_check() { return handicap_check; } float Passenger:: getP_rating() { return p_rating; } bool Passenger:: getPet_check() { return pet_check; }
__MACOSX/EagleLyft/._passenger.cpp
EagleLyft/passenger.h
#ifndef PASSENGER_H_ #define PASSENGER_H_ #include <string> #include <iostream> using namespace std; class Passenger//creating a passenger class { private: string name;//declaring the passenger name int p_ID;//declaring the passenger id string payment;//declaring type of payment bool handicap_check;//declaring handicap or not float p_rating;//declaring passenger rating bool pet_check;//declaring the pet check option public: Passenger();//default constructor Passenger(string, int, string, bool, float,bool); // parameterized constructor //mutators void setName(string); void setP_ID(int); void setPayment(string); void setHandicap_check(bool); void setP_rating(float); void setPet_check(bool); //accessors string getName(); int getP_ID(); string getPayment(); bool getHandicap_check(); float getP_rating(); bool getPet_check(); }; #endif
__MACOSX/EagleLyft/._passenger.h
EagleLyft/passengers.cpp
#include <iostream> #include <string> #include <vector> using namespace std; #include "passengers.h"//including the passengers header file #include "passenger.h"//including the passenger header file void Passengers::add_passenger()//adding a passenger { string name; int id; string c; int d; float e; int f; Passenger* temp; temp = new Passenger; cin.ignore(); cout << " Enter Name: " << endl; getline(cin, name); temp->setName(name); cout << " Enter ID Number: " << endl; cin >> id; temp->setP_ID(id); cout << " Enter Payment Type: " << endl; cin >> c; cin.ignore(); temp->setPayment(c); cout << " Handicapped?(1 for Yes or 0 for No): " << endl; cin >> d; temp->setHandicap_check(d); cout << " Enter Passenger Rating: " << endl; cin >> e; temp->setP_rating(e); cout << " Are Pets Allowed?(1 for Yes or 0 for No): " << endl; cin >> f; temp->setPet_check(f); PassengersList.push_back(*temp); } void Passengers::edit_passenger()//editing a passenger { string n; string eName; int epassID; string ePayment; int eHandicapped; float eRating; int ePets; cout << " Enter the name of the passenger you want to edit: "; cin.ignore(); getline(cin,n); for (int i=0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getName() == n) { cout << " Enter new Name: " << endl; getline(cin, eName); PassengersList.at(i).setName(eName); cout << " Enter new passenger ID: " << endl; cin >>epassID; PassengersList.at(i).setP_ID(epassID); cout << " Enter new payment: " << endl; getline(cin, ePayment); cin.ignore(); PassengersList.at(i).setPayment(ePayment); cout << " Handicapped? (1 for Yes or 0 for No): " << endl; cin >> eHandicapped; PassengersList.at(i).setHandicap_check(eHandicapped); cout << " Enter new Rating: " << endl; cin >> eRating; PassengersList.at(i).setP_rating(eRating); cout << " Pets? (1 for Yes or 0 for No): " << endl; cin >> ePets; PassengersList.at(i).setPet_check(ePets); cout<<" Passenger Details " << PassengersList.at(i).getName() << " edited successfully!!"<< endl; return; } } cout << " Passenger Details not found!" << endl; } void Passengers::delete_passenger()//deleting a passenger { string a; cout << " Enter the name of the passenger you want to delete: "; getline(cin, a); for (int i = 0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getName() == a) { PassengersList.erase(PassengersList.begin() + i); cout << " Passenger Details " << a << " deleted successfully!!" << endl; return; } } cout << " Passenger Details not found!" << endl; } void Passengers::search_passenger()//searching a passenger { string c; cout << " Enter the name of the passenger you want to search: "; getline(cin,c); for (int i = 0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getName() == c) { cout << " Passenger Details Found!" << endl << endl; cout << " Name: " << PassengersList.at(i).getName() << endl; cout << " ID: " << PassengersList.at(i).getP_ID() << endl; cout << " Payment: " << PassengersList.at(i).getPayment() << endl; cout << " Handdicapped: " << PassengersList.at(i).getHandicap_check() << endl; cout << " Rating: " << PassengersList.at(i).getP_rating() << endl; cout << " Pets: " << PassengersList.at(i).getPet_check() << endl << endl; return; } } cout << " Passenger Details not found!" << endl << endl; } void Passengers::print_passengerList()//printing the passenger list { for (int i = 0; i < PassengersList.size(); i++) { cout << " Name: " << PassengersList.at(i).getName() << endl; cout << " ID: " << PassengersList.at(i).getP_ID() << endl; cout << " Payment: " << PassengersList.at(i).getPayment() << endl; cout << " Handdicapped: " << PassengersList.at(i).getHandicap_check() << endl; cout << " Rating: " << PassengersList.at(i).getP_rating() << endl; cout << " Pets: " << PassengersList.at(i).getPet_check() << endl << endl; } cout << " End of the List!" << endl << endl; } void Passengers::print_passengerSearch()//printing a particular passenger { string x; cout << " Enter the name of the passenger to Print: "; getline(cin, x); for (int i = 0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getName() == x) { cout << " Passenger Details Found!" << endl << endl; cout << " Name: " << PassengersList.at(i).getName() << endl; cout << " ID: " << PassengersList.at(i).getP_ID() << endl; cout << " Payment: " << PassengersList.at(i).getPayment() << endl; cout << " Handdicapped: " << PassengersList.at(i).getHandicap_check() << endl; cout << " Rating: " << PassengersList.at(i).getP_rating() << endl; cout << " Pets: " << PassengersList.at(i).getPet_check() << endl << endl; return; } } cout << " Passenger Details not found!" << endl << endl; } bool Passengers::passengerHandicapped()//checking if customer is handicapped or not { string a; cout << " Enter Passenger Name: "; getline(cin,a); for (int i = 0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getName() == a) { if (PassengersList.at(i).getHandicap_check() == 1) { return true; } } } return false; } bool Passengers::passengerPets()//checking if passenger has pets or not { int b; cout << " Enter Passenger ID: "; cin >> b; for (int i = 0; i < PassengersList.size(); i++) { if (PassengersList.at(i).getPet_check() == b) { if (PassengersList.at(i).getPet_check() == 1) { return true; } } } return false; }
__MACOSX/EagleLyft/._passengers.cpp
EagleLyft/passengers.h
#include "passenger.h"//including passenger header file class Passengers//creating a Passengers class { private: vector <Passenger> PassengersList;//creating a vector int passenger_count; public: Passenger* findPassenger(); //functions for passenger void add_passenger(); void edit_passenger(); void delete_passenger(); void search_passenger(); //printing the passengers info void print_passengerList(); void print_passengerSearch(); //checking bool passengerHandicapped(); bool passengerPets(); };
__MACOSX/EagleLyft/._passengers.h
__MACOSX/EagleLyft/._Report.docx
EagleLyft/ride.cpp
#include <iostream> #include <string> #include <time.h> #include <cstdlib> using namespace std; #include "ride.h"//including the ride header file Ride::Ride()//default constructor { ride_ID = 0; pickup_location = ""; pickup_time = 0; dropoff_location = ""; sizeof_party = 0; include_pets = ""; dropoff_time = 0; ride_status = ""; r_rating = 0; status = 0; } Ride::Ride(int ride_ID, string pickup_location, time_t pickup_time, string dropoff_location, int sizeof_party, bool include_pets, time_t dropoff_time, string ride_status, float r_rating, int status) {//parameterized constructor ride_ID = ride_ID; pickup_location = pickup_location; pickup_time = pickup_time; dropoff_location = dropoff_location; sizeof_party = sizeof_party; include_pets = include_pets; dropoff_time = dropoff_time; ride_status = ride_status; r_rating = r_rating; status = status; } //mutators void Ride::setRide_ID(int ride_ID) { this->ride_ID = ride_ID; } void Ride::setPickup_location(string pickup_location) { this->pickup_location = pickup_location; } void Ride::setPickup_time(time_t pickup_time) { this->pickup_time = pickup_time; } void Ride:: setDropoff_location(string dropoff_location) { this->dropoff_location = dropoff_location; } void Ride:: setSizeof_party(int sizeof_party) { this->sizeof_party = sizeof_party; } void Ride:: setInclude_pets(bool include_pets) { this->include_pets = include_pets; } void Ride:: setDropoff_time(time_t dropoff_time) { this->dropoff_time = dropoff_time; } void Ride:: setRide_status(string ride_status) { this->ride_status = ride_status; } void Ride:: setR_rating(float r_rating) { this->r_rating = r_rating; } void Ride::setStatus(int status) { this->status = status; } void Ride::printinfo() { struct tm* mytm1; struct tm* mytm2; mytm1 = gmtime( &pickup_time); mytm2 = gmtime( &dropoff_time); cout << " Ride Information" << endl; cout << " Ride ID: " << ride_ID << endl; cout << " Pick-Up Location: " << pickup_location << endl; cout << " Pick-Up Time: " << asctime(mytm1) << endl; cout << " Drop-off Location: " << dropoff_location << endl; cout << " Size of party: " << sizeof_party << endl; cout << " Include Pets? (Y or N): " << include_pets << endl; cout << " Drop-off Time: " << asctime(mytm2) << endl; cout << " Ride Status: " << ride_status << endl; cout << " Ride Rating: " << r_rating << endl; } //accessors int Ride::getRide_ID() { return ride_ID; } string Ride::getPickup_location() { return pickup_location; } time_t Ride::getPickup_time() { return pickup_time; } string Ride:: getDropoff_location() { return dropoff_location; } int Ride:: getSizeof_party() { return sizeof_party; } bool Ride:: getInclude_pets() { return include_pets; } time_t Ride:: getDropoff_time() { return dropoff_time; } string Ride:: getRide_status() { return ride_status; } float Ride:: getR_rating() { return r_rating; } int Ride::getStatus() { return status; }
__MACOSX/EagleLyft/._ride.cpp
EagleLyft/ride.h
#ifndef RIDE_H_ #define RIDE_H_ #include <string> #include <iostream> using namespace std; class Ride//declaring a class Ride { private: int ride_ID;//declaring the ride id string pickup_location;//declaring the pickup location time_t pickup_time;//declaring the pickup time string dropoff_location;//declaring the dropoff location int sizeof_party;//declaring the size of party bool include_pets;//declaring the including pet option time_t dropoff_time;//declaring the dropoff time string ride_status;//declaring the ride status float r_rating;//declaring the ride rating int status;//declaring the status public: Ride();//default parameter Ride(int, string, time_t, string, int, bool, time_t,string, float,int); // parameterized constructor //mutators void setRide_ID(int); void setPickup_location(string); void setPickup_time(time_t); void setDropoff_location(string); void setSizeof_party(int); void setInclude_pets(bool); void setDropoff_time(time_t); void setRide_status(string); void setR_rating(float); void printinfo(); void setStatus(int); //accessors int getRide_ID(); string getPickup_location(); time_t getPickup_time(); string getDropoff_location(); int getSizeof_party(); bool getInclude_pets(); time_t getDropoff_time(); string getRide_status(); float getR_rating(); int getStatus(); }; #endif
__MACOSX/EagleLyft/._ride.h
EagleLyft/rides.cpp
#include <iostream> #include <string> #include <vector> #include <time.h> #include <cstdlib> using namespace std; #include "rides.h"//including rides header file #include "ride.h"//including ride header file #include "driver.h"//including driver header file #include "drivers.h"//including drivers header file #include "passenger.h"//including passenger header file #include "passengers.h"//including passengers header file extern Drivers mydriver;//including the drivers class object extern Passengers mypassenger;//including the passengers class object Rides::Rides()//default constructor { ride_count = 0; } int Rides::getCount()//getting ride count { return ride_count; } void Rides::incCount()//increasing ride count { ride_count++; } void Rides::decCount()//decreasing ride count { ride_count--; } void Rides::add_ride()//adding ride { Ride* rd; int a; int d; string b; string c; string f; int e; float i; time_t timeval; rd = new Ride; cout << " Enter Ride ID: "; cin >> a; cin.ignore(); rd->setRide_ID(a); cout << " Enter Pick-Up Location: "; getline(cin,b); rd->setPickup_location(b); cout << " Enter Pick-Up Time, "; timeval = getdatetime(); rd->setPickup_time(timeval); cout << " Enter Drop-Off Location: "; getline(cin, c); rd->setDropoff_location(b); cout << " Enter Size of Party: "; cin >> d; rd->setSizeof_party(d); cout << " Include pets? (1 for Yes or 0 for No): "; cin >> e; rd->setInclude_pets(e); cout << " Enter Drop-off Time, "; timeval = getdatetime(); rd->setDropoff_time(timeval); cout << " Enter Ride Status: "; cin >> f; cin.ignore(); rd->setRide_status(f); cout << " Enter Ride Rating: "; cin >> i; cin.ignore(); rd-> setR_rating(i); ridesList.push_back(*rd); incCount(); } void Rides::delete_ride()//deleting ride { int rnum; cout << " Enter the number of the Ride to Delete: " << endl; cin >> rnum; cin.ignore(); for (int i = 0; i < ridesList.size(); i++) { if (ridesList.at(i).getRide_ID() == rnum) { ridesList.erase(ridesList.begin() + i); cout << " Ride Details " << rnum << " deleted successfully!!" << endl; decCount(); return; } } cout << " Ride Details not found!" << endl; return; } void Rides::edit_ride()//editing ride { int num; int choice = -1; string s; int j,k; unsigned int ui; time_t timeval; cout << " Enter the Ride ID to edit: " << endl; cin >> num; cin.ignore(); for (int i = 0; i < ride_count; i++) { if (ridesList[i].getRide_ID() == num) { while (choice != 0) { cout << " ---Edit Ride Menu---\n"; cout << " 1 - Change Ride" << endl; cout << " 2 - Change Pick-Up Location" << endl; cout << " 3 - Change Drop-Off Location" << endl; cout << " 4 - Change Pick-UP Time" << endl; cout << " 5 - Change Drop-Off Time" << endl; cout << " 0 - Quit" << endl; cout << " Enter choice: "; cin >> choice; cin.ignore(); switch (choice) { case 0: return; break; case 1: cout << " Enter new Ride ID: "; cin >> num; cin.ignore(); ridesList[i].setRide_ID(num); break; case 2: cout << " Enter new Pick-Up Location: "; cin >> s; cin.ignore(); ridesList[i].setPickup_location(s); break; case 3: cout << " Enter new Drop-Off Location: "; cin >> s; cin.ignore(); ridesList[i].setDropoff_location(s); break; case 4: timeval = getdatetime(); ridesList[i].setPickup_time(timeval); break; case 5: timeval = getdatetime(); ridesList[i].setDropoff_time(timeval); break; } } } return; } cout << " Ride not found" << endl; return; } int Rides::find_ride(int num)//finding ride { for (int i = 0; i < ride_count; i++) { if (ridesList[i].getRide_ID() == num) { return i; } } cout << " Ride not found" << endl; return -1; } void Rides::print_Ride(int num)//printing a ride { for (int i = 0; i < ride_count; i++) { if (ridesList[i].getRide_ID() == num) { cout << " ---Ride Information for Ride--- " << num << endl; cout << " Ride ID: " << ridesList[i].getRide_ID() << endl; struct tm* mytm1; struct tm* mytm2; time_t tm1, tm2; tm1 = ridesList[i].getPickup_time(); mytm1 = gmtime(&tm1); cout << " Pick-Up Time: " << asctime(mytm1) << endl; tm2 = ridesList[i].getDropoff_time(); mytm2 = gmtime(&tm2); cout << " Drop-Off Time: " << asctime(mytm2) << endl; cout << " Pick-Up Location: " << ridesList[i].getPickup_location() << endl; cout << " Drop-Off Location: " << ridesList[i].getDropoff_location() << endl; cout << endl; return; } } } void Rides::print_allRides()//printing all rides { for (int i = 0; i < ride_count; i++) { cout << " ---Ride Schedule for All Rides--- " << endl; cout << " Ride ID: " << ridesList[i].getRide_ID() << endl; struct tm* mytm1; struct tm* mytm2; time_t tm1, tm2; tm1 = ridesList[i].getPickup_time(); mytm1 = gmtime(&tm1); cout << " Pick-Up Time: " << asctime(mytm1) << endl; tm2 = ridesList[i].getDropoff_time(); mytm2 = gmtime(&tm2); cout << " Drop-Off Time: " << asctime(mytm2) << endl; cout << " Pick-Up Location: " << ridesList[i].getPickup_location() << endl; cout << " Drop-Off Location: " << ridesList[i].getDropoff_location() << endl; cout << endl; } } void Rides::print_ridesSchedule(int b)//printing ride schedule { for (int i = 0; i < ride_count; i++) { cout << " ---Ride Schedule for Ride Number--- " << b << endl; if (ridesList[i].getRide_ID() == b) { cout << " Ride number: " << ridesList[i].getRide_ID() << endl; struct tm* mytm1; struct tm* mytm2; time_t tm1, tm2; tm1 = ridesList[i].getPickup_time(); mytm1 = gmtime(&tm1); cout << " Pick-Up Time: " << asctime(mytm1) << endl; tm2 = ridesList[i].getDropoff_time(); mytm2 = gmtime(&tm2); cout << " Drop-Off Time: " << asctime(mytm2) << endl; cout << " Pick-Up Location: " << ridesList[i].getPickup_location() << endl; cout << " Drop-Off Location: " << ridesList[i].getDropoff_location() << endl; cout << endl; } } } void Rides::updateRide()//updating ride { time_t currtime; currtime = time(NULL); for (int i = 0; i < ride_count; i++) { if (ridesList[i].getDropoff_time() < currtime) ridesList[i].setStatus(3); } } bool Rides::isRideAvail(int ride_ID, time_t pickup_time, time_t dropoff_time)//checking to see if ride is available { bool stat = 1; for (int i = 0; i < ride_count; i++) { if (ridesList[i].getRide_ID() == ride_ID) { if (pickup_time >= ridesList[i].getPickup_time() || dropoff_time <= ridesList[i].getDropoff_time()) { stat = 0; return stat; } } } return stat; } time_t Rides::getdatetime()//getting the current time { time_t rawtime, newtime; struct tm * timeinfo; int year, month ,day; int hour, minute; cout << " Enter year: "; cin >> year; cin.ignore(); cout << " Enter month: "; cin >> month; cin.ignore(); cout << " Enter day: "; cin >> day; cin.ignore(); cout << " Enter hour (0-23): "; cin >> hour; cin.ignore(); cout << " Enter minute (0-59): "; cin >> minute; cin.ignore(); time ( &rawtime ); timeinfo = gmtime ( &rawtime ); timeinfo->tm_year = year - 1900; timeinfo->tm_mon = month - 1; timeinfo->tm_mday = day; timeinfo->tm_hour = hour; timeinfo->tm_min = minute; timeinfo->tm_sec = 0; newtime = mktime ( timeinfo ); return newtime; }
__MACOSX/EagleLyft/._rides.cpp
EagleLyft/rides.h
#include "ride.h"//including the ride header file class Rides//declaring a Rides class { private: int ride_count; vector <Ride> ridesList;//declaring a vector public: Rides();//default constructor int getCount(); void incCount(); void decCount(); //ride functions void add_ride(); void edit_ride(); void delete_ride(); int find_ride(int); //printing void print_ridesSchedule(int b); void print_Ride(int num); void print_allRides(); void updateRide(); bool isRideAvail(int, time_t, time_t); time_t getdatetime(); };