The provided code defines a system for managing an inventory of parts, with functionality for adding, updating, and deleting parts. The system is divided into two main classes: Part and Inventory.
Part Class
The Part class represents an individual part in the inventory. It has three attributes:
part_number: a unique identifier for the part.part_description: a brief description of the part.price: the cost of the part.
The class includes getters and setters for each attribute, with the setters allowing the part description and price to be updated.
Inventory Class
The Inventory class manages a collection of Part objects. It provides methods to:
add_part(part_number, part_description, price): Adds a new part to the inventory. It ensures that the part number is unique and within the specified character limit.delete_part(part_number): Removes a part from the inventory based on its part number.change_description(part_number, new_description): Updates the description of an existing part.change_price(part_number, new_price): Updates the price of an existing part.get_all_parts(): Returns a list of all parts currently in the inventory.
User Interface
The main() function provides a simple command-line interface for interacting with the inventory system. It allows the user to:
- Add a new part to the inventory.
- Change the description or price of an existing part.
- Delete a part from the inventory.
- View a list of all parts in the inventory.
- Exit the program.
The interface guides the user through each operation, ensuring that inputs are valid and providing feedback on the success or failure of each operation.
Implementation Notes
- The
Partclass uses Python's property decorators to manage attribute access and updates, encapsulating the internal state of each part. - The
Inventoryclass manages parts in a list and uses comprehensions and simple loops to find and update parts. - The
main()function includes input validation to ensure part numbers and descriptions are within specified lengths and that prices are valid numbers.
This system provides a foundational structure for managing a simple inventory of parts, suitable for educational purposes or as a base for further development into a more comprehensive inventory management system.
Authors
- Jomar C. Geron
- Pyarwin Jake E. Janoras
- 3CS-A
Metadata
Release files for AboutFinalProject 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| AboutFinalProject-0.1.tar.gz | 2.1 kB | Without provenance | Details for AboutFinalProject-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| AboutFinalProject-0.1-py3-none-any.whl | Python 3 | none | any | Details for AboutFinalProject-0.1-py3-none-any.whl |
Total release size: 4.2 kB
Release files / AboutFinalProject-0.1.tar.gz
| Download URL | AboutFinalProject-0.1.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b090aec86f5bf9239561f5d23b3a3cc549dbe75efb54b84366cbee24ecc328d3
|
|
BLAKE2b-256 checksum How to use checksums |
35fa2d0f0b6a1e4c56093fa350fe2a0947c39faee12cec695682dadb22fd19c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Release files / AboutFinalProject-0.1-py3-none-any.whl
| Download URL | AboutFinalProject-0.1-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa5d9d23a456248d52184e46c14cef7d087b7c9196e6251fd52c73dcd9cbe363
|
|
BLAKE2b-256 checksum How to use checksums |
9ab47432cf57468b860fc5ab91e2feace989829e740cb3c8fcbc46213232574b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.2
|
Security for AboutFinalProject 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.