Question

Code in Java please, I am very confused... Abby wants to start a backyard chicken egg...

Code in Java please, I am very confused...

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:

Part 1:

  1. Prompt the user for the variables noted above.
  2. If the user enters 0 for number of chickens, end the program (Hint: 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. (Note: you may ignore any left-over eggs)

Part 2:

  1. Since the number of chickens, eggs laid per chicken, and pounds of feed per chicken per day, scale linearly with the operation it becomes apparent that the profit or loss of the venture is heavily influenced by the cost of the feed. A larger flock could command bulk feed purchases resulting in a lower per pound costs. However, the time of year and weather may also impact the cost of feed. As such, Abby wants to calculate the cost per dozen with the supplied feed cost varied from -25% to +25% at 5% intervals. At each interval, output the cost per dozen assuming the other variables remain constant.

Hint: The easiest way to do this is to let the percent be controlled in a for-loop varying from -25 to 25 with a step of 5.

Part 3:

            Using UMLet or Draw.IO draw an activity diagram to document your programs implementation.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change. 


Thank You !

Note:
As HOMEWORKLIB strict policy & guidelines, I am only allowed to answer the first question please post the remaining Part 2 and 3 as a separate post, and I will be happy to answer them. Sorry for the inconvenience caused.

===========================================================================

import java.util.Scanner;

public class EggVenture {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        while (true){


            System.out.print("Enter the number of chickens: ");
            int chickens = scanner.nextInt();
            if (chickens == 0) break;
            System.out.print("Enter average # of eggs per chicken per day: ");
            double eggsRate = scanner.nextDouble();
            System.out.print("Enter pounds needed to feed per chicken per day: ");
            double pounds = scanner.nextDouble();
            System.out.print("Enter cost per pound for feed: ");
            double costPerPound = scanner.nextDouble();
            System.out.print("Enter empty cartoon cost: ");
            double cartoonCost = scanner.nextDouble();

            double totalCostinMonth = chickens * pounds * costPerPound * 30 + cartoonCost;
            double dozenEggCost = (12 * totalCostinMonth) / (chickens * eggsRate * 30);
            System.out.println("Number of chickens: " + chickens);
            System.out.println("Average # of eggs per chicken per day: " + eggsRate);
            System.out.println("Pounds needed to feed per chicken per day: " + pounds + " lbs");
            System.out.println("Cost per pound $" + costPerPound);
            System.out.println("Empty cartoon cost: $" + cartoonCost);
            System.out.println("Total feed cost per month: $" + totalCostinMonth);
            System.out.println("Cost to produce 12 eggs: " + dozenEggCost);
            System.out.println();
        }
        System.out.println("Bye!");
    }
}

==================================================

Add a comment
Know the answer?
Add Answer to:
Code in Java please, I am very confused... Abby wants to start a backyard chicken egg...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help with Part 2! Coded in Java please! Abby wants to start a backyard...

    I need help with Part 2! Coded in Java please! 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...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • I need help with this assignment. It's due Tuesday at 8 AM. Please follow the instructions thorou...

    I need help with this assignment. It's due Tuesday at 8 AM. Please follow the instructions thoroughly as to not use any advanced material we may not have gone over in class. The instructions let you know what all should be used. Thanks! Use only what you have learned in Chapters 1 - 7. Use of "advanced" material, material not in the text, or project does not follow the instructions, will result in a GRADE OF 0% for the project....

  • Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Probl...

    Please help, need to code for this business assignment using c++. Business Expense Reimbursements Calculator Problem statement: Business trip is part of the enterprise culture. Suppose a businessperson just completed a business trip for your company. Now, you are tasked to write a program that calculates and displays the total travel expenses, allowable expenses for the trip, and the excess that must be paid by the businessperson, if any The program should prompt the user for the following . The...

  • Please answer question 1,2,3 in details and explanation CASE 4 HELPING HAND ACCOUNTING FUNDAMENTALS "I got...

    Please answer question 1,2,3 in details and explanation CASE 4 HELPING HAND ACCOUNTING FUNDAMENTALS "I got real lucky when I was fired," William Pendleton was fond of telling his employees and business associates. Pendleton was an insurance salesman in Illinois nea hobby, he loved to tinker around the house and he developed a local reputation as a person who knew how to "fix things." Pendleton decided to capitalize on this reputation and opened a hardware store, Helping Hand, based on...

  • FART I TRUE FALSE QUESTIONS (10 points). Please write True (1) or False (F) on the...

    FART I TRUE FALSE QUESTIONS (10 points). Please write True (1) or False (F) on the blank Scarcity is the intimited nature of society's resources given society's limited wants 2. A reward is a type of positive incentive. 3. To remove difficulty of double coincidence of wants we use money. 4. An exogenous factor is a variable that can be controlled for inside the model. 5. The PPF will not have a constant slope. 6. The law of demand states...

  • I need help with this questions that are highlighter in the article please. CONTINUED (REFER TO...

    I need help with this questions that are highlighter in the article please. CONTINUED (REFER TO PAGE 274) Starbucks Takes Coffee Culture Around the World arbucks has also been successful in other European countries, of the city's heritage and identity. The French prefer dark espresso including the United Kingdom and Ireland. This success comes and the conventional wisdom is that Americans don't know what despite competition from local riva's such as Ireland's Insomnia Coffee good coffee is. As one Frenchman...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT