#include "item.h" /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::Item() // // Preconditions: None // // Postconditions: Student has been intialized and name, type, author, owner, price, and // availability have the default value of "none" // // Parameters: // None // Item::Item() { name="none"; type="none"; author="none"; owner="none"; price="none"; availability="none"; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetName(string namein) // // Preconditions: namein must be valid // // Postconditions: name will take on the value passed through from the parameter // // Parameters: // namein The string of which name is going to be equal to // void Item::SetName(string namein) { name=namein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetType(string typein) // // Preconditions: typein must be valid // // Postconditions: type will take on the value passed through from the parameter // // Parameters: // typein The string of which type is going to be equal to // void Item::SetType(string typein) { type=typein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetAuthor(string authorin) // // Preconditions: authorin must be valid // // Postconditions: author will take on the value passed through from the parameter // // Parameters: // authorin The string of which author is going to be equal to // void Item::SetAuthor(string authorin) { author=authorin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetOwner(string ownerin) // // Preconditions: ownerin must be valid // // Postconditions: owner will take on the value passed through from the parameter // // Parameters: // ownerin The string of which owner is going to be equal to // void Item::SetOwner(string ownerin) { owner=ownerin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetPrice(string pricein) // // Preconditions: pricein must be valid // // Postconditions: price will take on the value passed through from the parameter // // Parameters: // pricein The string of which price is going to be equal to // void Item::SetPrice(string pricein) { price=pricein; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::SetAvailability(string availabilityin) // // Preconditions: availabilityin must be valid // // Postconditions: availability will take on the value passed through from the parameter // // Parameters: // availabilityin The string of which availability is going to be equal to // void Item::SetAvailability(string availabilityin) { availability=availabilityin; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetName() const // // Preconditions: Item must be intialized // // Postconditions: returns the name string // // Parameters: // (none) // string Item::GetName() const { return name; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetType() const // // Preconditions: Item must be intialized // // Postconditions: returns the type string // // Parameters: // (none) // string Item::GetType() const { return type; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetAuthor() const // // Preconditions: Item must be intialized // // Postconditions: returns the author string // // Parameters: // (none) // string Item::GetAuthor() const { return author; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetOwner() const // // Preconditions: Item must be intialized // // Postconditions: returns the owner string // // Parameters: // (none) // string Item::GetOwner() const { return owner; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetPrice() const // // Preconditions: Item must be intialized // // Postconditions: returns the price string // // Parameters: // (none) // string Item::GetPrice() const { return price; } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::GetAvailability() const // // Preconditions: Item must be intialized // // Postconditions: returns the availability string // // Parameters: // (none) // string Item::GetAvailability() const { return availability; } void Item::PrintItem(ostream & outFile, bool DisplayOwner) const { if(owner == "none") { cout << "EMPTY" << endl; return; } else { if(name != "none") outFile << "Item: \n " << name << endl; if(type != "none") outFile << "Media Type: \n " << type << endl; if(author != "none") outFile << "by: \n " << author << endl; if(DisplayOwner == true) outFile << "Owner: \n " << owner << endl; if(price != "none") outFile << "Price: \n " << price << endl; if(availability != "none") outFile << "Availability: \n " << availability << "\n"; outFile << endl; } } /////////////////////////////////////////////////////////////////////////////// // // Member Object Definition: // Item::isEmpty() const // // Preconditions: none // // Postconditions: returns true if owner contains the default values or false if not // // Parameters: // (none) // bool Item::isEmpty() const { if(owner == "none") return true; else return false; }