Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement a simple console application in C + + that models an online store inventory system, based on the requirements and class relationships

Design and implement a simple console application in C++ that models an online store inventory system, based on the requirements and class relationships described below:
Class Descriptions:
Item: Represents a generic item sold in the online store. Each item is characterized by a unique identifier (ID), a name, and a price. The Item class should provide methods to get and set these properties. Additionally, it should include a method to print item details.
Vendor: Represents a vendor supplying items to the store. A vendor is described by a vendor ID, a name, and an address. This class should provide methods to get and set these properties. The toString() method should return a string representation of the vendor, including all its details.
Storeltem: Extends the Item class. In addition to the properties inherited from Item, Storeltem includes a property to store the vendor (supplier) of the item. The class should override the method to print item details to include vendor information if available. It should also include a method getVendorName() that returns the name of the vendor if set, or "Unknown" if not.
Implementation Details:
The Storeltem class should be initialized with an ID, name, and price. Vendor details should be set using a separate method, setVendor(), which takes a Vendor object as a parameter.
The toString() method in both Vendor and Storeltem should return a string representation of the object's state in a readable format. For Storeltem, implement two versions of toString(): one that only returns item details and another that also includes vendor details based on a boolean parameter.
Application Flow:
Your console application should prompt the user to enter details for a list of items and their corresponding vendors.
After entering the details, the application should display the information of each Storeltem using the toString() method, first without vendor details and then with vendor details.
It should also demonstrate the use of getVendorName() for each Storeltem.
Assignment Objectives:
Demonstrate understanding of class inheritance and polymorphism in C++.
Implement class methods, including constructors, accessors, mutators, and methods for string representation of objects.
Handle user input in a console application and display output based on the user input.
image text in transcribed

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

Advanced Database Systems

Authors: Carlo Zaniolo, Stefano Ceri, Christos Faloutsos, Richard T. Snodgrass, V.S. Subrahmanian, Roberto Zicari

1st Edition

155860443X, 978-1558604438

More Books

Students also viewed these Databases questions