The class Item has the following private member variables Data Type Variable Name string itemId string itemName string itemType string itemVendor Include appropriate setters and getters for the above class.   Include the following constructors in the Item class Constructor Name Description Item( )                                                                                                                                                                          This default constructor used to initialize the itemType as “Electricals” and itemVendor as “Arun electricals”                                                                                            Item(string itemId,string itemName,string itemType,string itemVendor)                                                                                                                                                                                                                                                                      This Parameterized constructor is used to assign values as entered by the user. In the main method, obtain input from the user in the console and create a new Item object and assign the values to the object's members using constructors. Display the item details in the main method.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 1PE: In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain...
icon
Related questions
Question

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

The class Item has the following private member variables

Data Type Variable Name
string itemId
string itemName
string itemType
string itemVendor

Include appropriate setters and getters for the above class.

 

Include the following constructors in the Item class

Constructor Name Description
Item( )                                                                                                                                                                          This default constructor used to initialize the itemType as “Electricals” and itemVendor as “Arun electricals”                                                                                           
Item(string itemId,string itemName,string itemType,string itemVendor)                                                                                                                                                                                                                                                                      This Parameterized constructor is used to assign values as entered by the user.


In the main method, obtain input from the user in the console and create a new Item object and assign the values to the object's members using constructors.

Display the item details in the main method.

 

Input  format:

The first line of input consists of an integer that corresponds to the choice 1 or 2

The next following inputs correspond to item details

 

Output  format:

Display the Item details

If the choice entered is not 1 or 2 print "Invalid choice"

Refer sample input and output for formatting specifications.

 

[All text in bold corresponds to input and rest corresponds to output]

Sample Input and Output 1:

Menu:

1.Electronics

2.Others

Enter your choice:

1

Enter details of the item

Enter item id:

Item001

Enter the item name:

Switch

Item details

Item id:Item001

Item name:Switch

Item type:Electricals

Item vendor:Arun electricals


Sample Input and Output 2:

Menu:

1.Electronics

2.Others

Enter your choice:

2

Enter details of the item

Enter item id:

Item002

Enter the item name:

Table

Enter the item type:

Furniture

Enter the item vendor:

Modern furniture

Item details

Item id: Item002

Item name: Table

Item type: Furniture

Item vendor: Modern furniture

 

Sample Input and Output 3:

M

Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.

The class Item has the following private member variables

Data Type Variable Name
string itemId
string itemName
string itemType
string itemVendor

Include appropriate setters and getters for the above class.

 

Include the following constructors in the Item class

Constructor Name Description
Item( )                                                                                                                                                                          This default constructor used to initialize the itemType as “Electricals” and itemVendor as “Arun electricals”                                                                                           
Item(string itemId,string itemName,string itemType,string itemVendor)                                                                                                                                                                                                                                                                      This Parameterized constructor is used to assign values as entered by the user.


In the main method, obtain input from the user in the console and create a new Item object and assign the values to the object's members using constructors.

Display the item details in the main method.

 

Input  format:

The first line of input consists of an integer that corresponds to the choice 1 or 2

The next following inputs correspond to item details

 

Output  format:

Display the Item details

If the choice entered is not 1 or 2 print "Invalid choice"

Refer sample input and output for formatting specifications.

 

[All text in bold corresponds to input and rest corresponds to output]

Sample Input and Output 1:

Menu:

1.Electronics

2.Others

Enter your choice:

1

Enter details of the item

Enter item id:

Item001

Enter the item name:

Switch

Item details

Item id:Item001

Item name:Switch

Item type:Electricals

Item vendor:Arun electricals


Sample Input and Output 2:

Menu:

1.Electronics

2.Others

Enter your choice:

2

Enter details of the item

Enter item id:

Item002

Enter the item name:

Table

Enter the item type:

Furniture

Enter the item vendor:

Modern furniture

Item details

Item id: Item002

Item name: Table

Item type: Furniture

Item vendor: Modern furniture

 

Sample Input and Output 3:

Menu:

1.Electronics

2.Others

Enter your choice:

4

Invalid choice

enu:

1.Electronics

2.Others

Enter your choice:

4

Invalid choice

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,