// File: OrderItem.cpp // // Implementation of OrderItem base class. // #include #include "OrderItem.h" using namespace std ; // Default order item constructor. Makes zombie object. // OrderItem::OrderItem() : m_sku(0), m_price(0), m_quantity(0) { // do nothing } // Alternate constructor. Use this one. // By default, 1 item is added to the order. // OrderItem::OrderItem(unsigned int sku, unsigned int price) : m_sku(sku), m_price(price), m_quantity(1) { // do nothing } // Print out the sku, price, quantity and cost. // void OrderItem::PrintItem() { cout << "SKU: " << m_sku << " Price: $" << m_price << " Quantity: " << m_quantity << " Cost: $" << ItemCost(*this) << "\n" ; } // Increase the quantity by 1. // void OrderItem::AddOne() { m_quantity++ ; } // Decrease the quantity by 1, if it is > 0. // Otherwise the quantity remains at 0. // void OrderItem::RemoveOne() { if (m_quantity > 0) m_quantity-- ; } // Compute the cost of an OrderItem. // The cost of an item equals the price * quantity plus 5% tax rounded // down. // unsigned int ItemCost(OrderItem& item) { // Implement this function !!! }