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.
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
Step by step
Solved in 4 steps with 3 images