To find the cost of each shirt based on the given data, we can analyze the information about the number of shirts and their corresponding costs.
Given:
- Number of shirts: 0, 5, 20, 50
- Costs: 200, 245, 380, 650
We can derive a function to represent the cost of ordering shirts. In this case, we can treat it as a piecewise linear function since the cost per shirt may vary with the quantity ordered.
- Cost Calculation:
- For 0 shirts: Cost = 0
- For 5 shirts: Cost = 245. So, the cost of each shirt for this range is \( \frac{245 - 200}{5 - 0} = \frac{45}{5} = 9\) per shirt for the first 5 shirts.
- For 20 shirts: Cost = 380. The cost per shirt calculation may vary:
- For 5 to 20 shirts (15 additional shirts): Cost increased from 245 to 380.
- So, the cost of each shirt in this range is \( \frac{380 - 245}{20 - 5} = \frac{135}{15} = 9\).
- For 50 shirts: Cost = 650. The cost per shirt calculation from 20 to 50 shirts:
- For 20 to 50 shirts (30 additional shirts): Cost increased from 380 to 650.
- So, the cost of each shirt in this range is \( \frac{650 - 380}{50 - 20} = \frac{270}{30} = 9\).
From this analysis, it seems that the cost per shirt is constant at 9 for the quantities analyzed, although there is a fixed cost associated, likely a base cost we need to account for.
- Function Representation: We can represent the cost function as follows in Python:
def cost_of_shirts(quantity):
if quantity < 0:
raise ValueError("Quantity cannot be negative")
elif quantity == 0:
return 200 # Fixed base cost for zero shirts
elif 0 < quantity <= 5:
return 200 + (9 * quantity) # For the first 5 shirts
elif 5 < quantity <= 20:
return 245 + (9 * (quantity - 5)) # Cost after 5 shirts
elif 20 < quantity <= 50:
return 380 + (9 * (quantity - 20)) # Cost after 20 shirts
else: # For any quantity greater than 50
return 650 + (9 * (quantity - 50)) # Arbitrarily extend the pattern
# Example usage
print(cost_of_shirts(0)) # Output: 200
print(cost_of_shirts(5)) # Output: 245
print(cost_of_shirts(20)) # Output: 380
print(cost_of_shirts(50)) # Output: 650
print(cost_of_shirts(10)) # Cost for 10 shirts
print(cost_of_shirts(60)) # Cost for 60 shirts
This function calculates the total cost based on the number of shirts ordered and accommodates for the tiered pricing structure derived from the initial data.