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

The application should store this data in the three objects and display the data

ID: 3769043 • Letter: T

Question

The application should store this data in the three objects and display the data for each employee on the screen. Retailltem Class Write a class named Retailltem that holds data about an item in a retail store. The class should have the following properties: Description-The Description property should hold a brief description of the item. UnitsOnHand-The UnitsOnHand property should hold the number of units currently in inventory. Price-The Price property should hold the item's retail price. Write a constructor that accepts arguments for each property. The application should create an array of three Retailltem objects containing the following data:

Explanation / Answer

#include #include class RetailItem { private: std::string description; int unitsOnHand; double price; public: // if we dont supply parameters RetailItem() { description = ""; unitsOnHand = 0; price = 0; } // when we do. RetailItem(std::string desc, int qty, double cost) { description = desc; unitsOnHand = qty; price = cost; } // Getters std::string getDescription() { return description; } int getUnits() { return unitsOnHand; } double getPrice() { return price; } // Setters void SetDescription(std::string desc) { description = desc; } void SetUnits(int qty) { unitsOnHand = qty; } void SetPrice(double cost) { price = cost; } }; int main() { // creating this way creates three objects with // default data, you then need to use the setters // to set the data. RetailItem Items[3]; // like this... Items[0].SetDescription("Jacket"); Items[0].SetUnits(12); Items[0].SetPrice(59.95); // items[1].. items[2] etc. // or we can use the constructor to assign data. RetailItem Item1("Jacket", 12, 59.95); // ok so lets read the data we assigned using setters for (int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote