Question: 3.12 Ch 3 program , part 1 : random temp. This is for zybooks and please be in java. please, have a neat code. 3.12

3.12 Ch 3 program , part 1 : random temp. This is for zybooks and please be in java. please, have a neat code.

3.12 Ch 3 program , part 1 : random temp. This isfor zybooks and please be in java. please, have a neat code.

3.12 Ch 3 Program, part 1: Random Temperatures This program will use the Random class to generate random temperatures integers) between some minimum (inclusive) and some maximum (inclusive) values. You will need to calculate the minimum and maximum given a starting temperature integer and a possible change in temperature integer. (1) Copy the following method stub into your Temperature Predictor class and complete it according to the specifications described in the header comments. * Generates a random temperature (int) within a range when given the current temperature * and the possible temperature change inclusive. Example: for a temperature of 40 and a change of 5, the method should produce a * random temperature between 35 and 45 inclusive @param rand The Random object * @param currTemp The current Temperature * @param change the possible change in temperature * @return A random value between the temperature-range and temperature+range inclusive public static int get Temp (Random rand, int currTemp, int changeInTemp) { //FILL IN BODY (2) Complete the main method using the following steps: . You should create an instance of a Random class (Random object) with a seed of Config.SEED. The instance will be passed to your method get Temp as the argument for the first parameter. Then, print out (each on their own line) the first 3 random temperatures generated by called get Temp with the Random object previously created, a current temperature of 65, and a possible change in temperature 10. When printing, use the following format "Temperature: 48 F", for example. . Finally, print out two additional calls to getTemp (each on their own line) with different arguments. Try to think of arguments that might test the functionality of your getTemp method in different ways. Note that your arguments should be int literals. These Finally, print out two additional calls to getTemp (each on their own line) with different arguments. Try to think of arguments that might test the functionality of your getTemp method in different ways. Note that your arguments should be int literals. These additional calls should be placed after the comment line: // Additional tests: ***DO NOT REMOVE THIS LINE*** The output for the first three calls should be: Temperature: 72 F Temperature: 61 F Temperature: 55 F For testing purposes, we require being able to predict the 'random' results. Setting a seed for the random number generator accomplishes this because it allows for a pseudo random number to be generated in a predictable order. For example, a seed of 85 for range of (3 to 9] may result in 4, 4,9 for the first three values, while a seed of 2 for the same range may result in 5, 3, 4 for the first three values. With everyone using the same seed value, we are able to determine if your code produces the correct 'random' values. Without setting the seed, the results of the random number generator will always be different, making it impossible to verify that your code works. As discussed above in (2), Config.SEED is a constant named SEED declared in the Config.java file. Don't use the number in your Random Generator program, just use this constant. Before turning in, remember to Style and Comment following the course standards CS 200 Style. Created by Elliott Janssen Saldivar. Reviewed and unit tested by Rami Dahman. 2/11/2020 jimw modified 5. Additional tests in main to allow digits in the random generator name

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!