Background The local chocolate factory is going to try a curry flavoured dark chocolate. They need...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Background The local chocolate factory is going to try a curry flavoured dark chocolate. They need to trial the amount of curry which they add so that the best flavour can be determined. This concentration can range from no curry-all chocolate (represented numerically as 0.0) up to all curry-no chocolate (represented numerically as 1.0). Banana is sometimes eaten with curry to reduce the 'heat' of the flavour. The chocolatier plans to add very small banana pieces to the chocolate too. The amount needs to be determined to match the curry and this will be trialled for a defined range too. Modelling will be used to simulate the trials of different amounts of curry and banana to optimise taste. To reduce cost, a 'sweet spot' of 500 Sweet Flavour Accents (SweetFAs - the well-known international standard unit) has been set as the target. Once a combination of curry, banana, and dark chocolate reaches/exceeds 500 SweetFAs the trial will conclude. The food scientists have derived an equation for the tastiness of the chocolate: Banana factor = 120-number of banana pieces Flavour = curry concentration* (800 - (banana factor* banana factor)) Program specification You and your partner must write a Java program to calculate and display all possible flavours for a range of banana pieces and curry concentrations. First, your program should obtain the following information from the user: the minimum number of pieces of banana desired to be included; the maximum number of pieces of banana desired to be included; and a step size for the curry concentration 1/5 Once these values have been entered the program should check if the values entered are legal (all positive, the minimum less than or equal to the maximum, and with the difference between the minimum and maximum number of banana pieces not exceeding 10). If the values entered are not legal (range checks only - you don't have to detect incorrect types), the program should print an error message. If the values entered are valid, the program should produce a table of results displaying the flavour of the chocolate for each possible number of banana pieces in the range specified by the user. Each column in the table should show the results for a specific number of banana pieces, and should have this number displayed at the top of the column. Each row in the table should show the results for a particular curry concentration step, and should have that value displayed on the left to 2 decimal places. The first row should have a curry concentration equal to the step size given by the user, and the curry concentration should increase by that step size for each subsequent row. The program should keep adding rows to the table until either the curry concentration reaches/exceeds 1.0, or until a chocolate bar is produced reaching the threshold flavour of 500 SweetFAs. All calculations of flavour should be done using doubles, and the results should be displayed to 1 decimal place. Your solution should run in Dr Java and comprise the following files: SweetFAInterface.java and Sweet FA.java - the Flavour ADT. You should have the following methods: a constructor, "getters' and 'setters' for the curry concentration object and number of banana pieces, and 'doer' methods to calculate the flavour, determine whether the flavour exceeds the threshold, and convert the flavour to each of a double and a String. CurryInterface.java and Curry.java - the specification and implementation (respectively) of a curry concentration. A curry concentration should be implemented as a class with instance variables which consist of: o the current curry concentration value (as a double); and o the curry step value (as a double). The class should also contain methods as specified in the interface, i.e. a constructor, setter and getter for the step value, getter for the concentration value, a doer which checks whether the concentration value is at the maximum (and if so returns false, and if not increases the concentration value by the step and returns true), and a method to convert the concentration value to a String. AssigOne122.java - the file which contains the main () method. A starting point is available on MyLO for you to download. You should complete all the required files. Two example executions are shown below: The Local Chocolate Factory Enter the minimum number of banana pieces: 100 Enter the maximum number of banana pieces: 200 Enter the curry concentration step size: 0.14 Sorry, these are not legal. The Local Chocolate Factory Enter the minimum number of banana pieces: 102 Enter the maximum number of banana pieces: 109 Enter the curry concentration step size: 0.14 Curry 0.14 0.28 0.42 0.56 Number of banana pieces 102 103 104 66.6 71.5 133.3 143.1 76.2 80.5 152.3 161.0 253.7 322.0 338.2 199.9 214.6 228.5 241.5 266.6 286.2 304.6 0.70 333.2 357.7 380.8 402.5 422.8 399.8 429.2 457.0 483.0 507.4 0.84 105 106 84.6 169.1 107 108 88.3 91.8 176.7 183.7 265.0 275.5 353.4 367.4 441.7 459.2 530.0 551.0 every do, for, and while loop should have a block of code (ie. {}s) the keyword continue should not be used 109 95.1 190.1 Program Style Your program should follow the following coding conventions: final variable identifiers should be used as much as possible, should be written all in upper case and should be declared before all other variables variable identifiers should start with a lower case letter every if and if-else statement should have a block of code (i.e. collections of lines surrounded by (and )) for both the if part and the else part (if used) 285.2 380.2 o Each variable declaration should be commented 475.3 570.4 the keyword break should only be used as part of a switch statement opening and closing braces of a block should be aligned all code within a block should be aligned and indented 1 tab stop (or 4 spaces) from the braces marking this block instance variables should be used sparingly with parameter lists used to pass information in and out of functions local variables (excluding loop counters) should only be declared at the beginning of methods (either as parameters or otherwise) commenting: There should be a block of header comment which includes at least file name student names student identity numbers a statement of the purpose of the program . date the percentage of the work completed by the authors - 50:50 is expected and assumed but reasons should be given if it is more/less than this 3/5 There should be comments that identify groups of statements that do various parts of the task o Comments should describe the strategy of the code and should not simply translate the Java into English Background The local chocolate factory is going to try a curry flavoured dark chocolate. They need to trial the amount of curry which they add so that the best flavour can be determined. This concentration can range from no curry-all chocolate (represented numerically as 0.0) up to all curry-no chocolate (represented numerically as 1.0). Banana is sometimes eaten with curry to reduce the 'heat' of the flavour. The chocolatier plans to add very small banana pieces to the chocolate too. The amount needs to be determined to match the curry and this will be trialled for a defined range too. Modelling will be used to simulate the trials of different amounts of curry and banana to optimise taste. To reduce cost, a 'sweet spot' of 500 Sweet Flavour Accents (SweetFAs - the well-known international standard unit) has been set as the target. Once a combination of curry, banana, and dark chocolate reaches/exceeds 500 SweetFAs the trial will conclude. The food scientists have derived an equation for the tastiness of the chocolate: Banana factor = 120-number of banana pieces Flavour = curry concentration* (800 - (banana factor* banana factor)) Program specification You and your partner must write a Java program to calculate and display all possible flavours for a range of banana pieces and curry concentrations. First, your program should obtain the following information from the user: the minimum number of pieces of banana desired to be included; the maximum number of pieces of banana desired to be included; and a step size for the curry concentration 1/5 Once these values have been entered the program should check if the values entered are legal (all positive, the minimum less than or equal to the maximum, and with the difference between the minimum and maximum number of banana pieces not exceeding 10). If the values entered are not legal (range checks only - you don't have to detect incorrect types), the program should print an error message. If the values entered are valid, the program should produce a table of results displaying the flavour of the chocolate for each possible number of banana pieces in the range specified by the user. Each column in the table should show the results for a specific number of banana pieces, and should have this number displayed at the top of the column. Each row in the table should show the results for a particular curry concentration step, and should have that value displayed on the left to 2 decimal places. The first row should have a curry concentration equal to the step size given by the user, and the curry concentration should increase by that step size for each subsequent row. The program should keep adding rows to the table until either the curry concentration reaches/exceeds 1.0, or until a chocolate bar is produced reaching the threshold flavour of 500 SweetFAs. All calculations of flavour should be done using doubles, and the results should be displayed to 1 decimal place. Your solution should run in Dr Java and comprise the following files: SweetFAInterface.java and Sweet FA.java - the Flavour ADT. You should have the following methods: a constructor, "getters' and 'setters' for the curry concentration object and number of banana pieces, and 'doer' methods to calculate the flavour, determine whether the flavour exceeds the threshold, and convert the flavour to each of a double and a String. CurryInterface.java and Curry.java - the specification and implementation (respectively) of a curry concentration. A curry concentration should be implemented as a class with instance variables which consist of: o the current curry concentration value (as a double); and o the curry step value (as a double). The class should also contain methods as specified in the interface, i.e. a constructor, setter and getter for the step value, getter for the concentration value, a doer which checks whether the concentration value is at the maximum (and if so returns false, and if not increases the concentration value by the step and returns true), and a method to convert the concentration value to a String. AssigOne122.java - the file which contains the main () method. A starting point is available on MyLO for you to download. You should complete all the required files. Two example executions are shown below: The Local Chocolate Factory Enter the minimum number of banana pieces: 100 Enter the maximum number of banana pieces: 200 Enter the curry concentration step size: 0.14 Sorry, these are not legal. The Local Chocolate Factory Enter the minimum number of banana pieces: 102 Enter the maximum number of banana pieces: 109 Enter the curry concentration step size: 0.14 Curry 0.14 0.28 0.42 0.56 Number of banana pieces 102 103 104 66.6 71.5 133.3 143.1 76.2 80.5 152.3 161.0 253.7 322.0 338.2 199.9 214.6 228.5 241.5 266.6 286.2 304.6 0.70 333.2 357.7 380.8 402.5 422.8 399.8 429.2 457.0 483.0 507.4 0.84 105 106 84.6 169.1 107 108 88.3 91.8 176.7 183.7 265.0 275.5 353.4 367.4 441.7 459.2 530.0 551.0 every do, for, and while loop should have a block of code (ie. {}s) the keyword continue should not be used 109 95.1 190.1 Program Style Your program should follow the following coding conventions: final variable identifiers should be used as much as possible, should be written all in upper case and should be declared before all other variables variable identifiers should start with a lower case letter every if and if-else statement should have a block of code (i.e. collections of lines surrounded by (and )) for both the if part and the else part (if used) 285.2 380.2 o Each variable declaration should be commented 475.3 570.4 the keyword break should only be used as part of a switch statement opening and closing braces of a block should be aligned all code within a block should be aligned and indented 1 tab stop (or 4 spaces) from the braces marking this block instance variables should be used sparingly with parameter lists used to pass information in and out of functions local variables (excluding loop counters) should only be declared at the beginning of methods (either as parameters or otherwise) commenting: There should be a block of header comment which includes at least file name student names student identity numbers a statement of the purpose of the program . date the percentage of the work completed by the authors - 50:50 is expected and assumed but reasons should be given if it is more/less than this 3/5 There should be comments that identify groups of statements that do various parts of the task o Comments should describe the strategy of the code and should not simply translate the Java into English
Expert Answer:
Related Book For
Operations Management Creating Value Along the Supply Chain
ISBN: 978-0470525906
7th Edition
Authors: Roberta S. Russell, Bernard W. Taylor
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
The following information was drawn from the 2016 accounting records of Ozark Merchandisers: 1. Inventory that had cost $21,200 was sold for $39,900 under terms 2/20, net/30. 2. Customers returned...
-
The City of Fort Collins, Colorado, has adopted the budgeting for outcomes entrepreneurial budgeting method as a basis for its budgeting process. Required Locate the city's most recent budget...
-
Crinkle Cut Clothes Company manufactures two products CC1 and CC2. Current direct material and direct labor costs are detailed below. Next year the company wishes to use a plantwide overhead rate...
-
Find a sample settlement agreement. Of those covered in this chapter, what type of settlement agreement did you find?
-
Guyer Company publishes a monthly sports magazine, Fishing Preview. Subscriptions to the magazine cost $20 per year. During November 2010, Guyer sells 12,000 subscriptions beginning with the December...
-
7. A force is applied to a post as shown below. Determine (a) The x- and y-components of the force. (b) The x' and y'-components of the force. Y 30 F = 950 N
-
An article by J. J. Pignatiello, Jr. and J. S. Ramberg in the Journal of Quality Technology (Vol. 17, 1985, pp. 198- 206) describes the use of a replicated fractional factorial to investigate the...
-
ABC Corporation is considering launching a new product line. The total cost of developing and launching the product is estimated to be $1.5 million. The product is expected to generate annual...
-
The topic ( Policy Against Bullying and Harassment at Commonwealth Bank) Training To combat bullying and harassment, we will train and educate all employees and managers. This will include details on...
-
Multiply and simplify. (x+22) (x-22)= (x + 2) = 0
-
You are the production manager at a pharmaceutical manufacturing company in Malaysia. The company is determined to improve its demand forecasting methods and explore different approaches to achieve...
-
What are the activities (system procurement, testing, documentation, training, implementation and evaluation) roles/purpose? How does the activities for system implementation help? Also, are each...
-
How is an x-y "graph for the eye" different from x vs. t or y vs. t graphs?
-
QUESTION 26 1. Given an array of elements 5, 7, 9, 1, 3, 10, 8, 4, build a binary max-heap, match answers with the questions. (5 points) Formula to find the height of the tree. Formula to find the...
-
Identify the most stable compound:
-
List several alternatives for adjusting capacity. List several alternatives for managing demand.
-
The Hartley-Davis motorcycle dealer in the Minneapolis St. Paul area wants to be able to forecast accurately the demand for the Roadhog Super motorcycle during the next month. From sales records, the...
-
Amtrex International is a major U.S.-based electronics firm that manufactures a number of electronic components for domestic and global consumer electronics companies. It imports most of its...
-
Derive the equations of motion for the system in Figure 5.28 for generalized coordinates \(\theta_{1}\) and \(\theta_{2}\) using (a) Lagrange's equation and (b) Hamilton's principle. m. L. IG eeeee...
-
Consider again the system of Figure 2.57, reproduced in Figure 5.32. Derive the equation of motion using (a) Lagrange's equation, and (b) Hamilton's principle, for generalized coordinate \(x\). eeeee...
-
Consider again the system of Figure 2.53, reproduced in Figure 5.30. A mass \(m\) is suspended by a pulley system with a spring. Derive the equation of motion of the system using (a) Lagrange's...
Study smarter with the SolutionInn App