Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Inventory.java #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MADHUMITHASIVAKUMARR
Copy link

This Java code defines an Inventory class that represents an inventory item with attributes such as name, expiry date, price, and quantity. Here’s a breakdown of its components:

Attributes:
name: The name of the inventory item (String).
expiryDate: The expiry date of the item (Date).
price: The price of the item (int).
quantity: The quantity of the item in stock (int).

Constructor:
The constructor initializes the attributes of the Inventory class with values passed as parameters.

Main Method:
This is the entry point of the program. It prompts the user to input details for an inventory item: The name of the item.
The expiry date in the format yyyy-mm-dd, which is then converted to a Date object. The price of the item.
The quantity of the item.
After gathering the inputs, it creates an instance of the Inventory class with the provided values.

Scanner:
A Scanner object is used to read user input from the console. It is closed at the end of the method to free up system resources.

This Java code defines an Inventory class that represents an inventory item with attributes such as name, expiry date, price, and quantity. Here’s a breakdown of its components:

Attributes:
name: The name of the inventory item (String).
expiryDate: The expiry date of the item (Date).
price: The price of the item (int).
quantity: The quantity of the item in stock (int).

Constructor:
The constructor initializes the attributes of the Inventory class with values passed as parameters.

Main Method:
This is the entry point of the program. It prompts the user to input details for an inventory item:
The name of the item.
The expiry date in the format yyyy-mm-dd, which is then converted to a Date object.
The price of the item.
The quantity of the item.
After gathering the inputs, it creates an instance of the Inventory class with the provided values.

Scanner:
A Scanner object is used to read user input from the console. It is closed at the end of the method to free up system resources.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant