//flightinfo.h -- assignment 3, summer 2001 //author: Rebecca Price, id: XXXXXXX, section: AA, TA: Man Chun Liu #ifndef FLIGHTINFO_H #define FLIGHTINFO_H #include #include #include #include using namespace std; //#define DEBUGGING = 1; class Flight{ public: Flight(); //Default Constructor: sets all seven flight parameters to zero values. //Precondition: None; //Postcondition: The values contained in the flight instance are zeros. Flight(Flight& other); //Copy Constructor: copies the flight info in other into a new instance // of flight. //Precondition: The new flight instance gets the values of a current // flight instance. //Postcondition: The new flight instance has the same values of the // original flight it was set to. Flight& operator= (const Flight& other); //Overload Operator = so that a new instance of Flight gets the values // of the instance other. //Precondition: the operator is called properly using an initialized instance on // the right side of the gets operator. //Postcondition: the info of other is also found in the new instance. bool operator==(const Flight& other); //Overload Operator == to determine if departure location, arrival location and date // of departure are the same as in the instance other. If they are the same true is // return, otherwise it returns false. //Preconditions: the two instances have been initialized. //Postconditions: true is returned if all of the variables, above, are equal. // returns false if not all of them are equal. void copy(const Flight& other); //Copies the info of instance other in to the current Flight. //Preconditions: other has been initialized. //Postconditions: the values of the new instance are equal to other's values. ~Flight(); //Destructor: Not really needed but use for spec requirements. void PrintInfo() const; //Prints out all the values of Flight except the canceledFlight value. //Preconditions: the instance has been initialized. //Postconditions: the Flight data memeber have been printed out. //Setters - sets the private data members to the passed in value. void SetFlightNum(string number); void SetDepatureLoc(string loc); void SetArrivalLoc(string loc); void SetDepartTime(string time); void SetArrivalTime(string time); void SetDate(string date); void SetPrice(double amount); void SetCanceledFlight(bool state); //Getters - returns the need information. string GetFlightNum() const; string GetDepartureLoc() const; string GetArrivalLoc() const; string GetDepartTime() const; string GetArrivalTime() const; string GetDepartDate() const; double GetPrice() const; bool FlightIsCanceled() const; // done for readability in code private: string flightNum; //Stores flight number. string departLoc; //Stores the departure location. string arrivalLoc; //Stores the arrival location. string departTime; //Stores the departure time. string arrivalTime; //Stores the arrival time. string departDate; //Stores the departure date. double price; //Stores the price of the flight. bool canceledFlight; //Stores a bool pretaining to whether or not // the flight has been canceled. }; #endif