#include "media.h" #define NDEBUG #include using namespace std; //////////////////////////////////////////////////////////////// // Initialize variables in the class to false // Parameters: // -None // // Pre: -None // // Post: variables in class have a default value // // Returns: none // // Called by: none // // Calls: None ///////////////////////////////////////////////////////////////// item::item() { itemSet = false; //Has the type of item been set ? mediaSet = false; //What type of media are we dealing with ? authorSet = false; //Who is the author of the item ? ownerSet = false; //Who owns the item ? priceSet = false; //Has the price been set ? available = false; //Is item available ? resetPrev = false; } item::~item() { //Destructor } //////////////////////////////////////////////////////////////// // Sets the string variable "availablility" to whatever string is being passed in // // Parameters: // string available-- email of the target student // // Pre: -None // // Post: availability is set to equal the incoming string variable available // // Returns: boolean value true // // Called by: addItem(); initializeItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setAvailable(string available) { item::availability = available; return true; } //////////////////////////////////////////////////////////////// // Sets the string variable "item" to whatever string is being passed in // // Parameters: // string item-- email of the target student // // Pre: -None // // Post: itemName is set to equal the incoming string variable "item" // // Returns: boolean value true // // Called by: addItem(); initializeItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setItem(string item) { item::itemName = item; //Set the name of the item return true; } //////////////////////////////////////////////////////////////// // Sets the string variable "mediaType" to whatever string is being passed in // // Parameters: // string media-- email of the target student // // Pre: -None // // Post: mediaType is set to equal the incoming string variable "media" // // Returns: boolean value true // // Called by: addItem(); initializeItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setMedia(string media) { item::mediaType = media; //Set the media type return true; } //////////////////////////////////////////////////////////////// // Sets the string variable "author" to whatever string is being passed in // // Parameters: // string author-- email of the target student // // Pre: -None // // Post: author is set to equal the incoming string variable "media" // // Returns: boolean value true // // Called by: addItem(); initializeItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setAuthor(string author) { item::author = author; //Set the author return true; } //////////////////////////////////////////////////////////////// // Sets the string variable "owner" to whatever string is being passed in // // Parameters: // string Owner-- email of the target student // // Pre: -None // // Post: owner is set to equal the incoming string variable "Owner" // // Returns: boolean value true // // Called by: addItem(); initializeItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setOwner(string Owner) { item::owner = Owner; //Set the price return true; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "authorSet" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::authorPresent() const { return authorSet; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "available" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::isAvailable() const { return available; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "itemSet" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::itemPresent() const { return itemSet; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "mediaSet" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::mediaPresent() const { return mediaSet; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "ownerSet" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::ownerPresent() const { return ownerSet; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "priceSet" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: printEmail(); printItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::pricePresent() const { return priceSet; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "mediaSet" // // Parameters: // -None // // Pre: -None // // Post: The variable mediaSet is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivateMedia() { mediaSet = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "itemSet" // // Parameters: // -None // // Pre: -None // // Post: The variable itemSet is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivateItem() { itemSet = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "author" // // Parameters: // -None // // Pre: -None // // Post: The variable authorSet is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivateAuthor() { authorSet = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "ownerSet" // // Parameters: // -None // // Pre: -None // // Post: The variable ownerSet is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivateOwner() { ownerSet = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "priceSet" // // Parameters: // -None // // Pre: -None // // Post: The variable priceSet is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivatePrice() { priceSet = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "available" // // Parameters: // -None // // Pre: -None // // Post: The variable available is set to true. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setPrivateAvailable() { available = true; } void item::resetInfo() { itemName =""; //Name of item mediaType=""; //Type of item author=""; //Creator of the item owner=""; //Owner of item---display owner's e-mail dollars = cents =0; //Price of item availability=""; //Availability of item itemSet = false; //Has the type of item been set ? mediaSet = false; //What type of media are we dealing with ? authorSet = false; //Who is the author of the item ? ownerSet = false; //Who owns the item ? priceSet = false; //Has the price been set ? available = false; //Is item available ? resetPrev = true; } //////////////////////////////////////////////////////////////// // Sets the boolean parameter to the variable "resetPret" // // Parameters: // -bool value --- paramater value to set to class item resetPrev // // Pre: -None // // Post: The variable resetPrev is set to value. // // Returns: None // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// void item::setReset(bool value) { resetPrev = value; } //////////////////////////////////////////////////////////////// // Returns the boolean value dependent upon the value set to the variable "resetPrev" // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: boolean value true/false // // Called by: addStudent(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::returnReset() const { return resetPrev; } //////////////////////////////////////////////////////////////// // Returns the string variable owner // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: string value owner // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// string item::getOwner() { return owner; } //////////////////////////////////////////////////////////////// // Returns the string variable item // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: string value item // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// string item::getItem() { return itemName; //Returns the name of the item } //////////////////////////////////////////////////////////////// // Returns the string variable mediaType // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: string value mediaType // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// string item::getMedia() { return mediaType; //Returns the media type of the item } //////////////////////////////////////////////////////////////// // Returns the string variable author // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: string value author // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// string item::getAuthor() { return author; //Returns the author of the item } //////////////////////////////////////////////////////////////// // Returns the string variable availability // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: string value availability // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// string item::getAvailability() { return availability;//Returns the availability status of item } //////////////////////////////////////////////////////////////// // Sets the unsigned int parameter to the variable "dolars" // // Parameters: // -unsigned int dinero ----- the dollars place // // Pre: -None // // Post: The variable dollars is set to equal the dollars place of the item // // Returns: True // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setDollar(unsigned int dinero) { item::dollars = dinero; //Set dollar data member return true; } //////////////////////////////////////////////////////////////// // Sets the unsigned int parameter to the variable "cents" // // Parameters: // -unsigned int cents ----- the dollars cents // // Pre: -None // // Post: The variable cents is set to equal the cents place of the item // // Returns: True/False // // Called by: initalizeItem(); addItem(); // // Calls: -None // ////////////////////////////////////////////////////////////////////////////////// bool item::setCent(unsigned int cents) { assert( cents > 99); //If its greater than 99 cents stop program item::cents = cents; //Set cents data member return true; } //////////////////////////////////////////////////////////////// // Returns the unsigned int variable dollars // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: unsigned int value dollars // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// unsigned int item::getDollar() { return dollars; //Get dollar data member } //////////////////////////////////////////////////////////////// // Returns the unsigned int variable cents // // Parameters: // -None // // Pre: -None // // Post: -None // // Returns: unsigned int value cent // // Called by: printEmail(); deleteEmail(); // // Calls: -None // /////////////////////////////////////////////////////////////////// unsigned int item::getCent() { return cents; //Get the cents data member }