#include "Multimedia.h" #include #include using namespace std; //////////////////////////////////////////////////////////////// DEFAULT CONSTRUCTOR // Default Multimedia Constructor // // Parameters: None // Pre: // Post: All variables are initalized // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None Multimedia::Multimedia () { myItem=""; myMediaType=""; myAuthor=""; myOwner=""; myPrice=""; myLocation=""; } //////////////////////////////////////////////////////////////// SIX PARAMETER CONSTRUCTOR // The 6 parameter Mulitmedia Constructor // // Parameters: string item, string mediatype, string author, string email, string price, string loc // Pre: // Post: All variables are initalized // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None Multimedia::Multimedia (string item, string mediatype, string author, string email, string price, string loc) { myItem=item; myMediaType=mediatype; myAuthor=author; myOwner=email; myPrice=price; myLocation=loc; } //////////////////////////////////////////////////////////////// Destructor // The multimedia destructor // // Parameters: // Pre: An object of the class has been created // Post: All variables are destructed // // Returns: None // // Called by: Anyone using the Multimedia class may call this destructor // Calls: None Multimedia::~Multimedia () { } //////////////////////////////////////////////////////////////// Item () const // Returns the myItem variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myItem variable has been returned. // // Returns: string myItem // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::Item () const { return myItem; } //////////////////////////////////////////////////////////////// MediaType () const // Returns the myMediaType variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myMediaType variable has been returned. // // Returns: string myMediaType // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::MediaType () const { return myMediaType; } //////////////////////////////////////////////////////////////// Author () const // Returns the myAuthor variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myAuthor variable has been returned. // // Returns: string myAuthor // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::Author () const { return myAuthor; } //////////////////////////////////////////////////////////////// Owner () const // Returns the myOwner variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myOwner variable has been returned. // // Returns: string myOwner // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::Owner () const { return myOwner; } //////////////////////////////////////////////////////////////// Price () const // Returns the myPrice variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myPrice variable has been returned. // // Returns: string myPrice // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::Price () const { return myPrice; } //////////////////////////////////////////////////////////////// ItemLoc () const // Returns the myItemLoc variable // // Parameters: None // Pre: The constructor has been called and variables initalized. // Post: The myItemLoc variable has been returned. // // Returns: string myItemLoc // // Called by: Anyone using the Multimedia class may call this function // Calls: None string Multimedia::ItemLoc () const { return myLocation; } //////////////////////////////////////////////////////////////// ChangeItem // Changes the value of myItem to user defined input // // Parameters: string newItem // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangeItem (string newItem) { myItem=newItem; } //////////////////////////////////////////////////////////////// ChangeMediaType // Changes the value of myMediaType to user defined input // // Parameters: string newMediaType // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangeMediaType (string newMediaType) { myMediaType=newMediaType; } //////////////////////////////////////////////////////////////// ChangeAuthor // Changes the value of myAuthor to user defined input // // Parameters: string newAuthor // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangeAuthor (string newAuthor) { myAuthor=newAuthor; } //////////////////////////////////////////////////////////////// ChangeOwner // Changes the value of myOwner to user defined input // // Parameters: string newOwner // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangeOwner (string newOwner) { myOwner=newOwner; } //////////////////////////////////////////////////////////////// ChangePrice // Changes the value of myPrice to user defined input // // Parameters: string newPrice // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangePrice (string newPrice) { myPrice=newPrice; } //////////////////////////////////////////////////////////////// ChangeLocation // Changes the value of myLocation to user defined input // // Parameters: string newLocation // Pre: The constructor has been called // Post: The value of the private variable has been changed // // Returns: None // // Called by: Anyone using the Multimedia class may call this function // Calls: None void Multimedia::ChangeLocation (string newLoc) { myLocation=newLoc; } //////////////////////////////////////////////////////////////// Operator << // Overloads the << operator for use with the Multimedia Class // // Parameters: ostream out, Multimedia multi // Pre: The constructor has been called // Post: The Multimedia sent has been output to the ostream // // Returns: an ostream object // // Called by: Anyone using the Multimedia class may call this function // Calls: None ostream & operator << (ostream & out, const Multimedia & multi) { if (multi.Item()!="") out<<"Item:"<