Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: Design an inventory class that stores the following members: serialNum: an integer that holds a parts serial number manufactDate: a member that holds the

Assignment:

Design an inventory class that stores the following members:

serialNum: an integer that holds a parts serial number

manufactDate: a member that holds the date the part was manufactured

lotNum: an integer that holds the parts lot number

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

Then, design a program that uses the queue class. The type of the queue should be the above inventory. 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 using inventory interfaces and added into the inventory 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.

What I have so far:

Header.h

#include #include #define SIZE 20 using namespace std; class inventory { public: int serialNum, lotNum; string manufactDate; }; class Queue { inventory inv[SIZE]; int front, rear; public: Queue() { rear = -1; front = 0; } void enqueue() { if (rear >= SIZE) { cout << "queue is full"; } else { rear++; cout << "Enter Serial Num: "; cin >> inv[rear].serialNum; cout << "Enter Manufacturing Date(MM/DD/YYYY): "; cin.getline >> inv[rear].manufactDate; cout << "Enter Lot Num: "; cin >> inv[rear].lotNum; } } void pop() { if (front>rear) { cout << "queue is empty"; } else {

cout << " Removed part details: "; cout << " Serial Num: " << inv[front].serialNum; cout << " Manufacturing Date: " << inv[front].manufactDate; cout << " Lot Num: " << inv[front].lotNum; front++; } } };

Main.cpp

#include "Header.h"; int main() { Queue q; int choice; do { cout << " ---------MENU------------ " << "1. Store " << "2. Remove " << "3. Exit " << "Enter choice: "; cin >> choice; switch (choice) { case 1: q.enqueue(); break; case 2: q.pop(); break; case 3: cout << " Exiting"; break; } } while (choice != 3); return 0; }

I am getting 3 errors. What do I need to change?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago