Inventory class using Queues

I'm a little confused with an assignment here and i just needed someone to point me in the right direction.


Objective

The objectives for this lab are to explore the functions of a queue, and to gain experience with exactly following specs for a module.

Assignment

Design an inventory class that stores the following members

serialNum: an integer that holds a part’s serial number
manufactDate: a member that holds the date the part was manufactured
lotNum: an integer that holds the part’s lot number

The class should have appropriate member functions for storing data into, and retrieving data from, these members.

Then, design a program that uses the queue class. The program should have a loop that asks the user whether he or she wishes to add a part to inventory or take a part from inventory. The loop should repeat until the user is finished.

If the user wishes to add a part to inventory, the program should ask for the serial number, date of manufacture, and lot number. The information should be stored in an inventory object and added into the queue.

If the user wishes to take a part from inventory, the program should remove the front part from the queue and display the contents of its member variables.

When the user finishes, the program should display the contents of the member values of all the objects that remain in the queue.

Follow our class coding standard to complete this lab, compile and run it, check out for credit.


Here is the Inventory class so far...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//Author: Chris Mouser
//Purpose: closed lab 10 header file for inventory class
//Date: 4/8/2011

#ifndef INVENTORY
#define INVENTORY

#include <iostream>
using namespace std;

const int QUEUE_CAPACITY = 100;

struct PartOrder
{
    QueueElement mySerialNum,
		         myLotNum,
		         myManufactureDate;
};

typedef PartOrder QueueElement;

class Inventory
{
private:
	QueueElement mySerialNum,
		     myLotNum,
	             myManufactureDate;
	int myFront, myBack;
	int count;
	QueueElement myArray[QUEUE_CAPACITY];

public:
	Inventory();                                                                          //default constructor
	Inventory(QueueElement serial_Num, QueueElement lot_Num, QueueElement manufact_Date);    //explicit value constructor
	bool empty() const;
	bool full() const;
	QueueElement GetPart() const;
	void SetPart(QueueElement serial_Num, QueueElement lot_Num, QueueElement manufact_Date); //not sure if this is needed
	void AddPart(QueueElement serial_num, QueueElement lot_Num, QueueElement manufact_Date);  //not sure if this is needed
	void removePart();
	void display() const;
	friend ostream & operator << (ostream & out, const QueueElement & Q);
};
#endif 


How far off am i? What is missing/not needed?
The assignment could be worded better, it's a little misleading.

Design an inventory class that stores the following members
This more likely means Design an inventory class that stores items. Each item has ...

Your PartOrder is the mostly ok and is the Queued Element.
1. Try to make up PartOrder using types that you're familiar with, such as int, string and so on.
2. The typedef you have says that PartOrder is the QueueElement. That's good.
3. Inventory should just have a collection of QueueElement and stuff to manipulate it. So myFront, myBack, count and myArray are fine. Remove mySerialNum, myLotNum, myManufactureDate.

I hope that helps.
Last edited on
that helps very much thank you. ill revise this and repost
Topic archived. No new replies allowed.