Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample Output: I need help with this java coding assignment. Please explain the code once you have completed it. I really want to learn how

image text in transcribedimage text in transcribedimage text in transcribed

Sample Output:

image text in transcribedimage text in transcribedimage text in transcribed

I need help with this java coding assignment. Please explain the code once you have completed it. I really want to learn how to go about doing this. Thank you very much for your help!

You are working for an ice cream manufacturer and distributor for high-end super-creamy ice cream. The seasonal sales division of your company supplies branded ice cream, including branded cones with branded paper wrappers, for seasonal outlets, including resorts, seasonal tourist areas (e.g., beaches and boardwalks), county and state fairs, and other short-season outlets. During the winter months, the company works to prepare for the surge season, including planning for ice cream manufacturing and ordering custom-printed cones. This planning is based on forecasting data for the coming summer season. You have been asked to use forecasting models developed by your company's data analytics department, and find the actual manufacturing needs for ice cream and cones for various seasonal outlets, together with the number of freezer boxes that would be needed to process the ice cream. Taking into account prior sales data and site surveys, the data analytics department developed a formula that estimates the demand for ice cream in gallons, given input values for the variables defined below: gallons =15+0.013438 temp +0.046875 client (1+0.75 weekend ) where gallons is the predicted demand of ice cream in U.S. gallons temp is the daily average temperature in degrees Fahrenheit client is the estimated number of customers per day weekend is either 0 for a weekday or 1 for a weekend The ice cream is sold by the scoop in cones, with 2 scoops per cone. There are 32 scoops in a gallon. The ice cream is made in freezer containers with the capacity of 4 gallons each. For any given outlet on any given day, your code needs to be able to compute how many gallons of ice cream will be needed, how many gallons will be made by filling the freezing containers fully, how many freezer containers will be filled completely and how much of the predicted demand could not be filled because it does not fill a complete freezing container. You also need to calculate how many cones need to be available for sale for the day in question, based on the input values. Requirements: Create a program that asks the user to enter the expected outside temperature in degrees Fahrenheit, expected number of customers per day, and whether the prediction is for a weekday (0) or a weekend (1). The program then calculates the expected demand of ice cream for that day in gallons, the amount of ice cream that can be frozen, the number of freezer containers, and the left over ice cream that does not fill a complete container. In addition, it calculates how many cones are needed to sell the amount of ice cream that can be produced. As output, the program prints to the screen the assumptions for the forecasted day (temperature, number of customers and weekend multiplier), the expected demand in gallons, the number of freezer containers needed, the amount of demand that cannot be used, and how many cones are required to sell the produced ice cream. Freezer containers and cones are reported as whole numbers. Instructions: 1. Prompt the user to enter three numbers: temperature in degrees Fahrenheit, number of clients, and whether the prediction is for a weekday (0) or weekend (1). Use the Scanner class for input and store the client count and weekend values in integer variables, store the temperature in a double. 2. Calculate the demand in gallons, given the formula, and store the result in a double variable. 3. Create a named constant for the capacity of a freezer container of 4 gallons per container and use it to get the number of freezer containers needed and store the result in a double. Since the freezer containers must be a whole number, cast the previous result into an integer and store the number of required containers in a new variable of type int. HINT: Look at the examples in the slides, starting at slide 38 of the Expressions slide set on Canvas, for examples of casting. 4. Use the modulus operator to calculate the amount of demand that does not fit into the freezing containers. Store the result in a double variable. It is the amount that is left over after the demand ice cream fills the required amount of containers. 5. Calculate the amount of ice cream that will be produced by completely filling the required number of freezing containers and store it in a variable. Use this amount to calculate the number of cones. 6. Create a named constant for the number of scoops per gallon (32) and use it to get the amount of produced ice cream scoops and store it in an integer variable. 7. Create a named constant for the number of scoops per cone (2) and use it to calculate the number of cones needed to sell the produced ice cream. Store the number of cones in an integer variable. 8. Print to screen the following information: temperature in degrees F o number of clients o weekend multiplier o expected demand in gallons o required number of freezer containers that can be filled completely 0 amount of demand that cannot be produced o amount of produced ice cream in gallons number cones that are needed for produced ice cream 9. Check your output carefully to ensure that it matches the sample output. For the purposes of this assignment, "matching" means that all spacing, wording, and punctuation in your output should match the sample output (except as described immediately below). Grading elements: - Use of class-level named constants - Use of variables with meaningful names and correct types - Input of data with user prompts - Correctness of math calculations - Conformance of output to sample output - Code organization (input/processing/output) NOTE ON ARITHMETIC PRECISION AND SAMPLE OUTPUT: When casting doubles into integers, the decimal numbers are truncated, so the results of arithmetic operations depend on the exact order of those operations. The Sample Output answers are valid only for the program logic that follows the Instructions exactly. You might find that your integer answers differ by 1 from those in the Sample Output if you did not follow the exact order of instructions. There are multiple paths to a valid solution and you might have a different way of solving the problem than presented in the Instructions. The grading is determined after looking at the logic of your code, so answers that are off by 1 in this case may still be correct if the logic makes sense. run: Enter temperature in degrees F : 32 Enter expected number of clients: 0 Enter 0 for weekday or 1 for weekend: 0 Demand prediction under the following assumptions: - Temperature: 32.0 degrees F - Expected clients: 0 - Weekend (1) / weekday (0):0 Expected demand: 15.430016 US gallons Required freezer containers: 3 Leftover gallons: 3.430016 Produced gallons: 12 Expected demand in cones: 192 BUILD SUCCESSEUL (total time: 3 seconds) run: Enter temperature in degrees F : 77 Enter expected number of clients: 230 Enter 0 for weekday or 1 for weekend: 0 Demand prediction under the following assumptions: - Temperature: 77.0 degrees F - Expected clients: 230 - Weekend (1) / weekday (0):0 Expected demand: 26.815976 US gallons Required freezer containers: 6 Leftover gallons: 2.815975999999999 Produced gallons: 24 Expected demand in cones: 384 BUILD SUCCESSEUL (total time: 3 seconds) run: Enter temperature in degrees F : 88 Enter expected number of clients: 129 Enter 0 for weekday or 1 for weekend: 1 Demand prediction under the following assumptions: - Temperature: 88.0 degrees F - Expected clients: 129 - Weekend (1) / weekday (0):1 Expected demand: 26.76457525 US gallons Required freezer containers: 6 Leftover gallons: 2.76457525 Produced gallons: 24 Expected demand in cones: 384 BUILD SUCCESSFUL (total time: 4 seconds) run: Enter temperature in degrees F : 56 Enter expected number of clients: 12 Enter 0 for weekday or 1 for weekend: 1 Demand prediction under the following assumptions: - Temperature: 56.0 degrees F - Expected clients: 12 - Weekend (1) / weekday (0):1 Expected demand: 16.736902999999998 US gallons Required freezer containers: 4 Leftover gallons: 0.7369029999999981 Produced gallons: 16 Expected demand in cones: 256 BUILD SUCCESSFUL (total time: 3 seconds) run: Enter temperature in degrees F: 95 Enter expected number of clients: 321 Enter 0 for weekday or 1 for weekend: 1 Demand prediction under the following assumptions: - Temperature: 95.0 degrees F - Expected clients: 321 - Weekend (1) / weekday (0):1 Expected demand: 42.608641250000005 US gallons Required freezer containers: 10 Leftover gallons: 2.608641250000005 Produced gallons: 40 Expected demand in cones: 640 BUILD SUCCESSFUL (total time: 10 seconds) run: Enter temperature in degrees F : 104.5 Enter expected number of clients: 57 Enter 0 for weekday or 1 for weekend: 0 Demand prediction under the following assumptions: - Temperature: 104.5 degrees F - Expected clients: 57 - Weekend (1) / weekday (0): 0 Expected demand: 19.076146 US gallons Required freezer containers: 4 Leftover gallons: 3.0761460000000014 Produced gallons: 16 Expected demand in cones: 256 BUILD SUCCESSEUL (total time: 12 seconds)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions