AboutPL
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file AboutFinalProject-0.1.tar.gz.
File metadata
- Download URL: AboutFinalProject-0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b090aec86f5bf9239561f5d23b3a3cc549dbe75efb54b84366cbee24ecc328d3
|
|
| MD5 |
4aa8d84f585a7beadbf1f7cbdcf03d4b
|
|
| BLAKE2b-256 |
35fa2d0f0b6a1e4c56093fa350fe2a0947c39faee12cec695682dadb22fd19c4
|
File details
Details for the file AboutFinalProject-0.1-py3-none-any.whl.
File metadata
- Download URL: AboutFinalProject-0.1-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa5d9d23a456248d52184e46c14cef7d087b7c9196e6251fd52c73dcd9cbe363
|
|
| MD5 |
ae1133692d8ea95e1055e4e4536f2eb5
|
|
| BLAKE2b-256 |
9ab47432cf57468b860fc5ab91e2feace989829e740cb3c8fcbc46213232574b
|