Abby wants to start a backyard chicken egg business. As any good she wants to “count the costs” of such an operation to determine if she can make a profit. While there are a number of variables, naturally the most influential ones are: Number of chickens Average number of eggs laid per day per chicken Pounds of feed per chicken per day Cost per pound for feed Empty carton cost
Abby wants to start a backyard chicken egg business. As any good she wants to “count the costs” of such an operation to determine if she can make a profit. While there are a number of variables, naturally the most influential ones are:
- Number of chickens
- Average number of eggs laid per day per chicken
- Pounds of feed per chicken per day
- Cost per pound for feed
- Empty carton cost
Not being much of a programmer yet, she needs your help by writing a program which will help her assess the viability of her venture. The program should fulfill the following requirements:
- Prompt the user for the variables noted above.
- If the user enters 0 for number of chickens, end the program (break out of the while loop).
- When all the parameters are entered, echo them back to the user identifying each one.
- Calculate the total cost of the operation per month. (Assume 30 days)
- Determine the cost to produce each dozen eggs. (you may ignore any left-over eggs)
I need help trying to find the total dozen of eggs. Based on the sample output screenshot, I found the total dozen of eggs by dividing the total operation cost($84.00) by the operation cost per dozen($4.20), but I need help finding the total dozen of eggs before finding the operation cost per dozen.
# Get the number of chickens from the user
num_chickens = int(input("Enter the number of chickens: "))
# Get the average number of eggs laid per day per chicken from the user
avg_eggs_per_day_per_chicken = float(input("Enter the average number of eggs laid per day per chicken: "))
# Get the feed cost per pound from the user
feed_cost_per_pound = float(input("Enter the feed cost per pound: "))
# Get the empty carton cost from the user
empty_carton_cost = float(input("Enter the empty carton cost: "))
# Get the feed per chicken per day from the user
feed_per_chicken_per_day = float(input("Enter the feed per chicken per day (lb): "))
# Calculate the total number of eggs in a month
total_eggs_in_month = num_chickens * avg_eggs_per_day_per_chicken * 30
# Calculate the total number of dozens of eggs
total_dozens_of_eggs = total_eggs_in_month / 12
# Round the total number of dozens of eggs to the nearest integer
total_dozens_of_eggs = round(total_dozens_of_eggs)
# Calculate the total feed cost
total_feed_cost = num_chickens * feed_per_chicken_per_day * feed_cost_per_pound * 30
# Calculate the total carton cost
total_carton_cost = total_dozens_of_eggs * empty_carton_cost
# Calculate the total cost of the operation
total_operation_cost = total_feed_cost + total_carton_cost
# Calculate the operating cost per dozen
operating_cost_per_dozen = total_operation_cost / total_dozens_of_eggs
# Echo the results back to the user
print("Results:")
print("Number of Chickens:", num_chickens)
print("Eggs laid per hen per day:", avg_eggs_per_day_per_chicken)
print("Feed Cost Per Pound: $%.2f" % feed_cost_per_pound)
print("Feed (lb) Per Hen Per Day:", feed_per_chicken_per_day)
print("Coat Per Carton: $%.2f" % empty_carton_cost)
print("Total Eggs:", total_eggs_in_month)
print("Total Feed Cost: $%.2f" % total_feed_cost)
print("Total Carton Cost: $%.2f" % total_carton_cost)
print("It costs $%.2f to produce %d dozen eggs" % (total_operation_cost, total_dozens_of_eggs))
print("Operating cost per dozen: $%.2f" % operating_cost_per_dozen)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps