Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

2.3 This software system shall define a structure called Item in a file called l

ID: 3599259 • Letter: 2

Question

2.3 This software system shall define a structure called Item in a file called ltem.h which contains all information to define an item which might be carried by a player character. 2.3.1 The ltem structure shall contain variables as described below: 2.3.1.1 A character array, called m_sltemName capable of holding strings of up to 64 characters. 2.3.1.2 An int called m iType used to indicate the type of item (Treasure, Weapon, etc.). 2.3.1.3 Two doubles called m_dWeight and m_dValue used to hold the weight (in pounds) and value (in gold pieces) of an item

Explanation / Answer

Hi,
header files are the ones that only have declarations, they are generally used to separate definitons from the implementation,
so here is the code for the item.h with comments,

#ifndef ITEM_H//defining the header file
#define ITEM_H

class Item
{
/*these are the declarations of the variables */
private :
int m_iType;
double m_dWeight;
double m_dValue;
char m_sItemName [64];
/* any mutator/accessor methods definition also goes here */
};

#endif

Thumbs up if this was helpful, otherwise let me know in comments