Public Member Functions | Protected Attributes | List of all members
Delivery Class Reference

#include <delivery.h>

Inheritance diagram for Delivery:
Bike

Public Member Functions

 Delivery ()
 
 Delivery (string id, string name, int gears, int capacity) throw ( invalid_argument )
 
void setID (string id) throw ( invalid_argument )
 
void setCapacity (int capacity) throw ( invalid_argument )
 
int getCapacity () const
 
virtual void print (ostream &out=cout) const
 
virtual void read (istream &in) throw ( invalid_argument )
 
- Public Member Functions inherited from Bike
 Bike ()
 
 Bike (string id, string name, int gears) throw ( invalid_argument )
 
void setID (string id) throw ( invalid_argument )
 
void setName (string name)
 
void setGears (int gears) throw ( invalid_argument )
 
string getID () const
 
string getName () const
 
int getGears () const
 
virtual ~Bike ()
 

Protected Attributes

int capacity
 
- Protected Attributes inherited from Bike
string id
 
string name
 
int gears
 

Detailed Description

Delivery class for storing information about a delivery bike, which has a load capacity.

Author
Mark Maloof
Version
1.0, 1/14/13

Constructor & Destructor Documentation

Delivery::Delivery ( )

Default constructor.

Delivery::Delivery ( string  id,
string  name,
int  gears,
int  capacity 
)
throw (invalid_argument
)

Explicit class constructor initializing a Delivery object using the arguments id, name, gears, and capacity.

Parameters
ida string storing the id of this bike
namea string storing the name of this bike
gearsan int storing the gears of this bike
capacityan int storing the capacity of this bike
Exceptions
invalid_argumentif an argument is invalid

Member Function Documentation

int Delivery::getCapacity ( ) const

Returns this bike's capacity.

Returns
an int storing this bike's capacity
void Delivery::print ( ostream &  out = cout) const
virtual

Prints this delivery bike to the ostream out, which defaults to cout.

Parameters
outan ostream for printing (defaults to cout)

Reimplemented from Bike.

void Delivery::read ( istream &  in)
throw (invalid_argument
)
virtual

Reads information for a delivery bike from the istream argument, storing the information in the respective data members.

Parameters
inan istream for reading
Exceptions
invalid_argumentif an argument is invalid

Reimplemented from Bike.

void Delivery::setCapacity ( int  capacity)
throw (invalid_argument
)

Sets this bike's capacity, which must be in {1, ..., 120}.

Parameters
capacityan int storing this bike's capacity
Exceptions
invalid_argumentif an argument is invalid
void Delivery::setID ( string  id)
throw (invalid_argument
)

Sets this delivery bike's ID, which must have the format D[0-9][0-9].

Parameters
ida string storing this bike's identifier
Exceptions
invalid_argumentif an argument is invalid

Sets this delivery bike's ID.

Parameters
ida string storing this bike's identifier
Exceptions
invalid_argumentif an argument is invalid

Member Data Documentation

int Delivery::capacity
protected

The documentation for this class was generated from the following files: