https://github.com/nguyennguyen0/bill-calculator
python CLI app to calculate electricity and water bills for shared accommodations.
https://github.com/nguyennguyen0/bill-calculator
cli pyfiglet python3 rich typer
Last synced: 3 months ago
JSON representation
python CLI app to calculate electricity and water bills for shared accommodations.
- Host: GitHub
- URL: https://github.com/nguyennguyen0/bill-calculator
- Owner: NguyenNguyen0
- Created: 2025-05-07T05:45:27.000Z (5 months ago)
- Default Branch: master
- Last Pushed: 2025-07-03T02:22:54.000Z (3 months ago)
- Last Synced: 2025-07-03T03:27:53.918Z (3 months ago)
- Topics: cli, pyfiglet, python3, rich, typer
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Electricity Bill Calculator
A Python-based application to calculate electricity and water bills for shared accommodations. The app distributes costs based on individual stay durations.
## Features
- Calculate electricity and water bills proportionally based on stay days.
- Support for manual or file-based input of residents and their days off.
- Save and load resident data for reuse.
- Interactive command-line interface with rich text formatting.## Installation
1. Clone the repository:
```bash
git clone https://github.com/NguyenNguyen0/calculate_electricity_bill.git
cd calculate_electricity_bill
```2. Install dependencies:
```bash
pip install -r requirements.txt
```## Usage
Run the application using:
```bash
python -m app
```### Command-Line Options
- `--electric-bill` or `-e`: Specify the total electricity bill.
- `--water-bill` or `-w`: Specify the total water bill.
- `--people` or `-p`: Provide a list of residents in the format `name=days_off` or just `name`.
- `--load-file` or `-lf`: Load resident data from a file.
- `--save-file` or `-sf`: Save resident data to a file.
- `--date-now` or `-dn`: Use the current date for calculations.
- `--month` or `-m` and `--year` or `-y`: Specify the billing month and year.Example:
```bash
python .\__main__.py main --electric-bill 500000 --water-bill 200000 --people "Alice=2" "Bob=1"
```## File Structure
- `models.py`: Contains data models for residents and bills.
- `calculator.py`: Handles bill calculations.
- `storage.py`: Manages saving and loading resident data.
- `ui.py`: Provides a rich-text user interface.
- `app.py`: Main application logic.
- `__main__.py`: Entry point for the application.## Requirements
- Python 3.10+
- Dependencies listed in `requirements.txt`## Contributing
Contributions are welcome! Please fork the repository and submit a pull request.
## License
This project is licensed under the MIT License. See the `LICENSE` file for details.