Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here is the inventoryItem.h // This class has overloaded constructors. #ifndef INVENTORYITEM_H #define INVENTORYITEM_H #include using namespace std; class InventoryItem { private: string description; //

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
here is the inventoryItem.h
// This class has overloaded constructors.
#ifndef INVENTORYITEM_H
#define INVENTORYITEM_H
#include
using namespace std;

class InventoryItem
{
private:
string description; // The item description
double cost; // The item cost
int units; // Number of units on hand
public:
// Constructor #1
InventoryItem()
{ // Initialize description, cost, and units.
description = "";
cost = 0.0;
units = 0; }

// Constructor #2
InventoryItem(string desc)
{ // Assign the value to description.
description = desc;

// Initialize cost and units.
cost = 0.0;
units = 0; }

// Constructor #3
InventoryItem(string desc, double c, int u)
{ // Assign values to description, cost, and units.
description = desc;
cost = c;
units = u; }

// Mutator functions
void setDescription(string d)
{ description = d; }

void setCost(double c)
{ cost = c; }

void setUnits(int u)
{ units = u; }

// Accessor functions
string getDescription() const
{ return description; }

double getCost() const
{ return cost; }

int getUnits() const
{ return units; }
};
#endif
This programming project is doe on Wednesday, November 15, 2023 Reminder: Do your ewn work on this project. Do not obtain any code from anotber studeat, or from the Internet. Do not show your eode to anyoee exeept the instructor, or an official BHCC Tufor. Refer also to the last page of the course Syllabus, for details about the BHCC policy regarding academic dishonesty. Be sure that you read and understand this entife document before you begin writing your code. Pay close attention to the Project Deliverables and Grading Criteria sections of this document. If you have questions, ask the instructor during elass or contact the instruktor by BHCC e-mail pmorganabhesedu. Inventory Application Program slans specification for the Iaveatanticas class. The programi must he ercanised as a "Consmand Lopp" program. (Refer to the The proyram mwat implesent the following intern bive coermant: a Inventory Application Program This project involves designing and creating a C+ + program that will utilize the InventoryItem class, which is deseribed in Section 13.10 (pages 803-807) and Section 13.12 (pages 809-812) of the Gaddis textbook. (The Inven tory I tem, h source code for this class is provided on Moodle.) Your program must not modify the class specification for the Inventoryltem class. The program must be organized as a "Command Loop" program. (Refer to the Ch06_sample_code_Commandl_oop... resource in the Sample Code section of Moodle.) The program must implement the following interactive commands: \begin{tabular}{|c|c|} \hline h & \begin{tabular}{l} Add parts: increase the enits value for an existing Inventory Itern object. \\ print Help text. \end{tabular} \\ \hline i & Input inventory data from a file. \\ \hline n & \begin{tabular}{l} create a New inventory ltem. \\ Output inventory dota to a filc: \end{tabular} \\ \hline \begin{tabular}{l} \\ p \end{tabular} & \begin{tabular}{l} Output inventory data to a file. \\ Print inventory list on the screen. \end{tabular} \\ \hline 4 & Quit (end the program). \\ \hline & Remove parts: reduce the units value for an eusting Iaventory Item object. \\ \hline \end{tabular} (Refer to the Kequirements for Interactive Commands section of this document for more detaik) The program mast create an array of 100 Inveatoryliem objects (or a inctor of Inveateryliem objects). Csc237 Project2 20231025 docx 10252023 11:43 AM puge 1 of 12 Data File Format The "input" / "output" commands read/ write data that is in a "pipe-delimited" text file. The format of each line of text, in the data file, is described below: When reading the data file, your program needs to read one line of text from the file at a time, break each line of text into separate fields (by calling the splitLineToArray function), and conver the text from each field to the correct data type. - Remember that the code to process the input file must ignore the first field of each line. There is no class variable in the InventoryItem class for inventory item number, and your program must not modify the InventoryItem class specification. - DO NOT create an inven toryItemNumber member variable in the Inventoryltem class. - Copy the splitLineToArray function that we discussed in class and is available on Moodle. The Sample Codesection of Moodle includes the Ch10_sample_code_SplitLineToArray_demo.... resource. The splitlineToArray function is part of that sample program. (DO NOT blindly copy the entire program.) Important Design Requirements - When processing an input data file, be sure to remember that the first field of each line of data in the input file must be ignored. - The output file format must be the same as the input file format. That is, any file that your program creates with the " " command must be readable by the " i " command of your program. - The units member variable of any Inventoryltem object must never be negative and also must never be greater than the value of 30 . Sample Test Data Four sample input files are provided: electrical.txt, fasteners.txt, miscellaneous.txt and plumbing.txt. The data files that your program creates must obey the same file format as these sample files. The program must work correctly with these files, as well as general files of similar format. Project Deliverables: The project source file(s) must be submitted to Moodle, using the Moodle Activity: CSC237_Project2 Submit your . cpp file(s) and any . h file(s) that you create. I will need to compile your code on my home computer in order to grade it. If you are submitting more than one file (.cpp and/or . h), do not enclose the files in a ZIP file. Moodle will allow you to submit multiple source files. For example: Do not submit the entire Visual Studio project. Do not include the project folders, or any binary files. Grading Criteria This programming project is doe on Wednesday, November 15, 2023 Reminder: Do your ewn work on this project. Do not obtain any code from anotber studeat, or from the Internet. Do not show your eode to anyoee exeept the instructor, or an official BHCC Tufor. Refer also to the last page of the course Syllabus, for details about the BHCC policy regarding academic dishonesty. Be sure that you read and understand this entife document before you begin writing your code. Pay close attention to the Project Deliverables and Grading Criteria sections of this document. If you have questions, ask the instructor during elass or contact the instruktor by BHCC e-mail pmorganabhesedu. Inventory Application Program slans specification for the Iaveatanticas class. The programi must he ercanised as a "Consmand Lopp" program. (Refer to the The proyram mwat implesent the following intern bive coermant: a Inventory Application Program This project involves designing and creating a C+ + program that will utilize the InventoryItem class, which is deseribed in Section 13.10 (pages 803-807) and Section 13.12 (pages 809-812) of the Gaddis textbook. (The Inven tory I tem, h source code for this class is provided on Moodle.) Your program must not modify the class specification for the Inventoryltem class. The program must be organized as a "Command Loop" program. (Refer to the Ch06_sample_code_Commandl_oop... resource in the Sample Code section of Moodle.) The program must implement the following interactive commands: \begin{tabular}{|c|c|} \hline h & \begin{tabular}{l} Add parts: increase the enits value for an existing Inventory Itern object. \\ print Help text. \end{tabular} \\ \hline i & Input inventory data from a file. \\ \hline n & \begin{tabular}{l} create a New inventory ltem. \\ Output inventory dota to a filc: \end{tabular} \\ \hline \begin{tabular}{l} \\ p \end{tabular} & \begin{tabular}{l} Output inventory data to a file. \\ Print inventory list on the screen. \end{tabular} \\ \hline 4 & Quit (end the program). \\ \hline & Remove parts: reduce the units value for an eusting Iaventory Item object. \\ \hline \end{tabular} (Refer to the Kequirements for Interactive Commands section of this document for more detaik) The program mast create an array of 100 Inveatoryliem objects (or a inctor of Inveateryliem objects). Csc237 Project2 20231025 docx 10252023 11:43 AM puge 1 of 12 Data File Format The "input" / "output" commands read/ write data that is in a "pipe-delimited" text file. The format of each line of text, in the data file, is described below: When reading the data file, your program needs to read one line of text from the file at a time, break each line of text into separate fields (by calling the splitLineToArray function), and conver the text from each field to the correct data type. - Remember that the code to process the input file must ignore the first field of each line. There is no class variable in the InventoryItem class for inventory item number, and your program must not modify the InventoryItem class specification. - DO NOT create an inven toryItemNumber member variable in the Inventoryltem class. - Copy the splitLineToArray function that we discussed in class and is available on Moodle. The Sample Codesection of Moodle includes the Ch10_sample_code_SplitLineToArray_demo.... resource. The splitlineToArray function is part of that sample program. (DO NOT blindly copy the entire program.) Important Design Requirements - When processing an input data file, be sure to remember that the first field of each line of data in the input file must be ignored. - The output file format must be the same as the input file format. That is, any file that your program creates with the " " command must be readable by the " i " command of your program. - The units member variable of any Inventoryltem object must never be negative and also must never be greater than the value of 30 . Sample Test Data Four sample input files are provided: electrical.txt, fasteners.txt, miscellaneous.txt and plumbing.txt. The data files that your program creates must obey the same file format as these sample files. The program must work correctly with these files, as well as general files of similar format. Project Deliverables: The project source file(s) must be submitted to Moodle, using the Moodle Activity: CSC237_Project2 Submit your . cpp file(s) and any . h file(s) that you create. I will need to compile your code on my home computer in order to grade it. If you are submitting more than one file (.cpp and/or . h), do not enclose the files in a ZIP file. Moodle will allow you to submit multiple source files. For example: Do not submit the entire Visual Studio project. Do not include the project folders, or any binary files. Grading Criteria

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions