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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:

  1. Prompt the user for the variables noted above.
  2. If the user enters 0 for number of chickens, end the program (break out of the while loop).
  3. When all the parameters are entered, echo them back to the user identifying each one.
  4. Calculate the total cost of the operation per month. (Assume 30 days)
  5. 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. 

Sample Output
Number of Chickens: 12
Eggs Per Hen: .7
Feed Cost Per Pound: .8
Egg Carton Cost: .6
Feed Per Hen Per Day (lb): .25
Results
Number of Chickens: 12
Eggs laid per hen per day: 0.70
Feed Cost Per Pound: $0.80
Feed (lb) Per Hen Per Day: 0.25
Cost Per Carton: $0.60
Total Eggs: 252.00
Total Feed Cost: $72.00
Total Carton Cost: $12.00
It costs $84.00 to produce 20 dozen eggs
Operating cost per dozen: $4.20
Transcribed Image Text:Sample Output Number of Chickens: 12 Eggs Per Hen: .7 Feed Cost Per Pound: .8 Egg Carton Cost: .6 Feed Per Hen Per Day (lb): .25 Results Number of Chickens: 12 Eggs laid per hen per day: 0.70 Feed Cost Per Pound: $0.80 Feed (lb) Per Hen Per Day: 0.25 Cost Per Carton: $0.60 Total Eggs: 252.00 Total Feed Cost: $72.00 Total Carton Cost: $12.00 It costs $84.00 to produce 20 dozen eggs Operating cost per dozen: $4.20
Expert Solution
Step 1

# 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

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Probability Problems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education