Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,917 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,088 people online right now. Registration is fast and FREE... Join Now!




building a class

 
Reply to this topicStart new topic

building a class

jrice528
10 Dec, 2007 - 07:11 PM
Post #1

New D.I.C Head
*

Joined: 29 Sep, 2007
Posts: 31


My Contributions
Getting ready to make a Retail Store program. I have instructions to build the class and jsut want to know I got it right before I start. the part I am having trouble with is the (get) function. I want to make sure to get the class right because if I dont get the class right I dont think id beable to dothe program right.


INSTRUCTIONS"

-Write a constructor that accepts a string containing the name of the store and initializes the number of items sold in the store to zero (it is an empty store!).

-Design and implement appropriate mutator (set) member functions that facilitate the following operations:

1-adding a new item into the store's inventory (given a description, number of units to add, and unit price of the item);

2-changing (by incrementing or decrementing) the number of units of a particular item in the store

3-changing the unit price of a particular item in the store

4-changing the description of a particular item in the store; and deleting a particular item in the store

-Design and implement appropriate accessor (get) member functions that
facilitate the following operations:

1-searching for a particular item in the store by giving (part of) a description (note that this operation is required by operations 2-5 listed under set member functions; this function should return the "index" of the item found);

2-return the RetailItem object of an item in the store, given the item's "index" value;

3-display the store's total inventory (showing description, units on hand, and unit price per item);

4-display items in the store's inventory whose number of available units falls below (less than) a given amount;

5-calculate the total value of the store's current inventory;



CLASS
CODE
#include "RetailItem.h"

using namespace std;

class RetailStore

{
      public:

             RetailItem();
             RetailItem(string StoreName, unsigned numItems);
            
            string setItemDescription();
            unsigned setItemUnits();
            unsigned setItemPrice();
            string setChangeDescription();
            unsigned setChangeUnits();
            unsigned setChangePrice();
            
            
            
            
            
      private:
               RetailItem r;
               static const unsigned size = 500;
               string StoreName;
               unsigned numItems;
               r.item[size];
              
};

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 02:33PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month