A management system for renting fishing and camping equipment. The application allows customer registration, order management, and earnings report generation.
- General Description
- Task 1 - Main Menu
- Task 2 - Equipment Hiring
- Task 3 - Earnings Report
- Installation and Execution
- File Structure
- Usage Examples
The application allows a small fishing shop to:
- Register customers and contact details
- Manage equipment rental orders
- Calculate costs with discounts
- Apply late return fees
- Generate earnings reports
✅ Input Validation - for every input field
✅ Automatic Price Calculation - with 50% discount for additional nights
✅ Late Fees - for returns after 2:00 PM
✅ Detailed Reports - with totals and statistics
✅ User-Friendly Interface - navigable menu
Task 1 implements the main menu of the application. The user can select between 3 main options: customer details, earnings report, or exit the application.
24987654_T1.py- Python code for Task 1
Displays the main menu nicely formatted.
def display_main_menu():
"""Displays the main menu with available options."""
print("\n" + "="*50)
print(" TACKLE HIRE MANAGEMENT SYSTEM")
print("="*50)
print("1. Customer and hire details")
print("2. Earnings report")
print("3. Exit")
print("="*50)Requests and validates the user's choice. Accepts only values 1, 2, or 3.
def get_menu_choice():
"""Requests and validates choice from menu (1, 2, or 3)."""
while True:
choice = input("\nEnter your choice (1, 2, or 3): ").strip()
if choice in ["1", "2", "3"]:
return choice
else:
print("Invalid choice! Please enter 1, 2, or 3.")The main loop that displays the menu and processes user selections.
def main_menu():
"""Main menu with infinite loop (until choosing 3 - Exit)."""
while True:
display_main_menu()
choice = get_menu_choice()
if choice == "1":
print("\n>>> Customer and hire details selected")
elif choice == "2":
print("\n>>> Earnings report selected")
elif choice == "3":
print("\nThank you for using Tackle Hire System. Goodbye!")
break- ✅ Accepts only "1", "2", "3"
- ✅ Ignores spaces before and after (
.strip()) - ✅ Redisplays error message if input is invalid
- ✅ Loop continues until a valid value is entered
==================================================
TACKLE HIRE MANAGEMENT SYSTEM
==================================================
1. Customer and hire details
2. Earnings report
3. Exit
==================================================
Enter your choice (1, 2, or 3): 5
Invalid choice! Please enter 1, 2, or 3.
Enter your choice (1, 2, or 3): 1
>>> Customer and hire details selected
==================================================
TACKLE HIRE MANAGEMENT SYSTEM
==================================================
- Select option 1 - displays correct message
- Select option 2 - displays correct message
- Select option 3 - program stops
- Enter 4 - displays error
- Enter "a" - displays error
- Enter "1 " (with spaces) - works (
.strip())
Task 2 implements the subroutine for registering a new equipment rental order. It allows collecting customer data, selecting equipment, and calculating the final cost.
24987654.py- Python code for Task 2 and Task 3
| Code | Equipment | Price/Night |
|---|---|---|
| 1 | Day chairs | £15.00 |
| 2 | Bed chairs | £25.00 |
| 3 | Bite Alarm (set of 3) | £20.00 |
| 4 | Bite Alarm (single) | £5.00 |
| 5 | Bait Boat | £60.00 |
| 6 | Camping tent | £20.00 |
| 7 | Sleeping bag | £20.00 |
| 8 | Rods (3lb TC) | £10.00 |
| 9 | Rods (Bait runners) | £5.00 |
| 10 | Reels (Bait runners) | £10.00 |
| 11 | Camping Gas stove | £10.00 |
Collects and validates customer information.
def get_customer_details():
"""Requests customer details with validation."""
# Returns dictionary with: customer_id, name, phone, house, postcode, cardValidations:
- Name: not empty
- Phone: minimum 7 characters
- Postcode: not empty
- Card: exactly 4 numeric digits
Displays the available equipment list with prices.
def display_equipment_menu():
"""Displays equipment list with prices."""
# Iterates through EQUIPMENT_PRICES and displays nicelyAllows selection and quantity of desired items.
def select_equipment():
"""
Allows equipment selection.
Returns list of dictionaries: [{"name": "...", "quantity": 2, "unit_price": 25.00}]
"""Process:
- Display equipment menu
- Request item code
- Request quantity
- Add to list
- Repeat until "0" is entered
Collects rental details (nights and late return).
def get_hire_details():
"""Requests number of nights and whether return was late."""
# Returns (nights, returned_late)Validations:
- Nights: between 1 and 7
- Late return: y or n
Main calculation - determines the total rental cost.
def calculate_hire_cost(equipment_list, nights, returned_late):
"""
Calculates total cost with 50% discount for additional nights.
Adds extra fee for late return.
"""Formula:
TOTAL COST = First night cost + (Cost/night × 0.5 × additional nights)
LATE FEE = Cost/night × 0.5 (if return after 2:00 PM)
Calculation Example:
Equipment: 2 x Bed chairs (£25 each) + 1 x Camping tent (£20)
Nights: 2
Late return: YES
First night = (2 × £25) + £20 = £70
Additional night (50% discount) = £70 × 0.5 = £35
Total cost = £70 + £35 = £105
Late return fee = £35
Main subroutine that orchestrates the entire order processing.
def hire_equipment():
"""
Processes a new order:
1. Collects customer data
2. Selects equipment
3. Collects details
4. Calculates cost
5. Saves to customer_hires
6. Displays confirmation
"""Each record in customer_hires contains:
{
"customer_id": 101,
"customer_name": "John Smith",
"phone": "01234567890",
"house": "42",
"postcode": "AB12 3CD",
"card": "1234",
"equipment": [
{
"name": "Bed chairs",
"quantity": 2,
"unit_price": 25.00
},
{
"name": "Camping tent",
"quantity": 1,
"unit_price": 20.00
}
],
"nights": 2,
"total_cost": 105.00,
"extra_charge": 35.00,
"returned_on_time": "n"
}============================================================
NEW EQUIPMENT HIRE
============================================================
Customer ID: 101
Enter customer name: John Smith
Enter phone number: 01234567890
Enter house number: 42
Enter postcode: AB12 3CD
Enter credit/debit card (last 4 digits): 1234
============================================================
AVAILABLE EQUIPMENT FOR HIRE
============================================================
(Equipment prices shown are per night/item)
------------------------------------------------------------
1. Day chairs £ 15.00
2. Bed chairs £ 25.00
...
6. Camping tent £ 20.00
------------------------------------------------------------
Select equipment code (or '0' to finish): 2
Enter quantity: 2
✓ Added 2 x Bed chairs
Select equipment code (or '0' to finish): 6
Enter quantity: 1
✓ Added 1 x Camping tent
Select equipment code (or '0' to finish): 0
Enter number of nights (1-7): 2
Was equipment returned after 2pm? (y/n): y
============================================================
HIRE CONFIRMATION
============================================================
Customer ID: 101
Customer Name: John Smith
Phone: 01234567890
Address: 42, AB12 3CD
Card: ****1234
Equipment hired:
- Bed chairs: 2 x £25.00
- Camping tent: 1 x £20.00
Number of nights: 2
Total cost: £105.00
Extra charge (late return): £35.00
Returned on time: n
============================================================
- Phone validation - rejects < 7 characters
- Card validation - accepts only 4 digits
- Equipment selection - adds correctly to list
- 1 night price calculation - no discount
- 2 nights price calculation - applies 50% discount
- Late fee calculation - applies only if late return
- Total calculation - combination of all factors
Task 3 implements the subroutine for generating the earnings report. It displays a table with all orders, totals, and statistics.
24987654.py- Python code for Task 2 and Task 3
Displays the complete report with all orders and totals.
def generate_earnings_report():
"""
Generates and displays earnings report with:
- All orders
- Total earnings
- Total late fees
- Grand total
"""- Checks if orders exist - if not, displays message
- Displays table header
- Iterates through each order - displays in row
- Calculates totals:
- Total earnings (sum of all
total_cost) - Total late fees (sum of all
extra_charge) - Grand total = earnings + fees
- Total earnings (sum of all
====================================================================================================
EARNINGS REPORT
====================================================================================================
Customer Equipment Nights Total Cost On Time Extra Charge
----------------------------------------------------------------------------------------------------
101 Bed chairs (2), Camping t... 2 £105.00 n £35.00
102 Day chairs (1) 1 £15.00 y £0.00
103 Bait Boat (1), Sleeping ba... 3 £120.00 n £30.00
----------------------------------------------------------------------------------------------------
TOTAL EARNINGS £240.00
TOTAL EXTRA CHARGES (Late Returns) £65.00
GRAND TOTAL £305.00
====================================================================================================
- Customer: Customer ID (10 characters)
- Equipment: Equipment name with quantities (35 characters, truncated with "...")
- Nights: Number of nights (8 characters)
- Total Cost: Total cost in pounds sterling (12 characters)
- On Time: y/n for on-time return (10 characters)
- Extra Charge: Extra fee in pounds sterling (12 characters)
The report uses the same data stored in customer_hires from Task 2. It updates automatically once a new order is added.
- No orders - displays appropriate message
- One order - displays correctly
- Multiple orders - calculates totals correctly
- With late fees - displays correctly
- Table formatting - columns aligned correctly
For Task 1 (menu only):
python3 24987654_T1.pyFor Task 2 and 3 (complete program):
python3 24987654.py$ python3 24987654.py
==================================================
TACKLE HIRE MANAGEMENT SYSTEM
==================================================
1. Customer and hire details
2. Earnings report
3. Exit
==================================================
Enter your choice (1, 2, or 3): 1
>>> Customer and hire details selected
[... order input process follows ...]Enter your choice (1, 2, or 3): 2
>>> Earnings report selected
[... table with orders and totals displayed ...]Enter your choice (1, 2, or 3): 3
Thank you for using Tackle Hire System. Goodbye!tackle-hire-system/
│
├── 24987654_T1.py # Task 1 - Main Menu
├── 24987654.py # Task 2 and Task 3 - Complete Program
├── 24987654.docx # Word document with flowcharts
└── README.md # This file
display_main_menu()- Displays menuget_menu_choice()- Validates choicemain_menu()- Main loop
- Task 1:
display_main_menu(),get_menu_choice(),main_menu() - Task 2:
get_customer_details(),select_equipment(),get_hire_details(),calculate_hire_cost(),hire_equipment() - Task 3:
generate_earnings_report() - Utility:
display_equipment_menu() - Constants:
EQUIPMENT_PRICES,customer_hires,next_customer_id
This application demonstrates:
✅ Dictionaries - equipment and data storage
✅ Lists - order storage
✅ Functions - modularity and reusability
✅ Loops - while and for loops
✅ Conditionals - if/elif/else and validations
✅ String formatting - f-strings and .format()
✅ Data Operations - sum, iteration, calculations
✅ Input Validation - try/except, if conditions
✅ Docstrings - code documentation
Solution: Make sure you didn't import external modules. Use only Python standard library.
Solution: Check that you used .strip() to remove spaces and that the if condition is correct.
Solution: Check the formula in calculate_hire_cost(). Make sure that:
- First night is regular price
- Additional nights have 50% discount
- Late fee applies only if nights > 1