Question: Create a method that accepts an array of doubles and returns the total of all temperatures /** totalTemp - returns the total of all temperatures

Create a method that accepts an array of doubles and returns the total of all temperatures /** totalTemp - returns the total of all temperatures in the array. *Precondition - The array has at least 1 element * @param (double[]) temps - an array of doubles * @return (double) the total of the values in the array */ Example Calls: totalTemp([67.5, 55.3, 57.8, 57.8, 58.2, 48.3, 39.5]) -> 384.4 totalTemp([76.5, 77.1, 81.2, 64.3, 61.5, 79.6, 77.2]) -> 517.000000000001 totalTemp([85.2, 84, 82, 81, 83.6, 77.5, 76.8]) -> 570.0999999999999 Create a method that accepts an array of doubles and returns the average temperature. /** avgTemp - returns the average of the temperatures in the array. *Precondition - The array has at least 1 element *@param (double[]) values - an array of doubles *@return (double) the average of the values in the array */ Example Calls: avgTemp([67.5, 55.3, 57.8, 57.8, 58.2, 48.3, 39.5]) -> 54.91428571428571 avgTemp([76.5, 77.1, 81.2, 64.3, 61.5, 79.6, 77.2]) -> 73.91428571428573 avgTemp([85.2, 84, 82, 81, 83.6, 77.5, 76.8]) -> 81.4428571485714 Create a method that accepts an array of doubles and returns the highest temperature. /** highTemp - returns the highest value of the temperatures array. *Precondition - The array has at least 1 element *@param (double[]) values - an array of doubles *@return (double) the maximum of the values in the array */ Example Calls: highTemp([67.5, 55.3, 57.8, 57.8, 58.2, 48.3, 39.5]) -> 67.5 highTemp([76.5, 77.1, 81.2, 64.3, 61.5, 79.6, 77.2]) -> 81.2 highTemp([85.2, 84, 82, 81, 83.6, 77.5, 76.8]) -> 95.27333333333333333 In the main method, call all methods and print the results out to the console.

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!