Question
You are a baker and you are in charge of baking two recipes. First is a chocolate chip cookie recipe. It makes four dozen cookies.
You are a baker and you are in charge of baking two recipes. First is a chocolate chip cookie recipe. It makes four dozen cookies. Ingredients: 2 cups all-purpose flour 1 teaspoon baking soda 1 teaspoon salt 1 cup (2 sticks) butter 1 cups sugar 1 teaspoon vanilla extract 2 eggs 2 cups chocolate chips Second is a banana bread recipe. It makes one loaf of banana bread. Ingredients: 3 bananas 1 3 cup butter cup sugar 1 egg 1 teaspoon vanilla extract 1 teaspoon baking soda 1 8 teaspoon salt 1 cups all-purpose flour The store sells the ingredients in the following packaged quantities and prices: 5 lb of all-purpose flour in a bag for $1.79 26 oz container of salt for $1.09 16 oz box of baking soda for $1.09 1 liquid ounce of vanilla extract for $3.99 1 dozen eggs for $2.19 1 lb bag of sugar for $1.99 1 lb (4 sticks) package of butter for $4.49 1 banana for $0.32 12 oz (2 cups) bag of chocolate chips for $3.29 Note that there are two kinds of ounces in the Imperial (American) measurement system, weight and volume. For this assignment, oz refers to a weight measurement and liquid ounce refers to a volume measurement. Here are some handy conversion factors: 3 1 3 cups of flour in a pound 6 teaspoons of salt or baking soda in an oz 2 cups of sugar in a pound 6 teaspoons in a liquid ounce 12 things in a dozen (hopefully you knew that one!) The recipes and price list have a couple of additional conversion factors in parentheses. Your assignment: Create a simple Java program. Name the class BakingCalculator. You will be writing static methods to calculate each ingredient quantity. These are the ingredient methods you must write: public static int bagsOfFlour(int cookieCount, int loafCount) public static int containersOfSalt(int cookieCount, int loafCount) public static int boxesOfBakingSoda(int cookieCount, int loafCount) public static int bottlesOfVanilla(int cookieCount, int loafCount) public static int cartonsOfEggs(int cookieCount, int loafCount) public static int bagsOfSugar(int cookieCount, int loafCount) public static int packagesOfButter(int cookieCount, int loafCount) public static int bananas(int cookieCount, int loafCount) public static int bagsOfChocolateChips(int cookieCount, int loafCount) For each ingredient method, the parameter cookieCount will define the number of individual chocolate chip cookies to buy ingredients for, and loafCount will define the number of banana bread loaves to buy for. Each method will use these parameter variables to scale the recipes and calculate and return how many of the method names item to buy. For example, bagsOfFlour should return the number of bags of flour to buy given the number of cookies and loaves provided as parameters. I recommend breaking each method up into small calculations using descriptive xPerY variable names. You must buy exactly as many items as you need to bake the recipes (you may end up with some left over but not a whole item). The same ingredients purchased can be used to bake both kinds of items (for example, you could split a bag of flour between the cookies and bread). Use the conversion factors in this document to determine how much to buy. You should not need to look up any other conversion factors. In addition, you must write one more method to calculate the cost of purchasing all ingredients necessary to bake the number of each item given in the parameters: public static double totalCost(int cookieCount, int loafCount) totalCost should use the other methods to help calculate its cost.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started