Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Instructions Upgrade your code in temps3.c based on workshop 8 to implement functions. The main program should prompt the user to input the number of
Instructions Upgrade your code in temps3.c based on workshop 8 to implement functions. The main program should prompt the user to input the number of days, the high and low for each. See the output example below. For each of the following functions, the prototype is to be placed above main() and then the function should be defined below/after the main() function. AT-HOME (60%) Define and implement highestTemp function Prototype a C function called highestTemp with one input parameter "double high[]" and one parameter int n" (the number of values in the array) before the main function The function should return an integer that is the index of the cell that has the highest temperature. . Define and implement lowestTemp function Prototype a C function called lowestTemp with one input parameter "double low[]" and one parameter "int n" (the number of values in the array) before the main function. The function should return an integer that is the index of the cell that has the lowest temperature. Define and implement avgTemp function Prototype a C function called avgTemp with three input parameters "const double low[]" ,"const double high[]" and int n representing the number of elements of the arrays before the main function. The arrays are qualified as cons to avoid any modifications to the data. The function should return a double that is the mean (average) temperature for a period entered by the user. Once you have completed the functions, you should hook up the functions in main to produce the output shown below. You will need to submit this code as part of the at home portion of the lab. Output Example ---=== BTM Temperature Calculator V3.0 ===--- Please enter the number of days, between 3 and 10, inclusive: 4 Day 1 - High: 6 Day 1 - Low: -2 Day 2 - High: 8 Day 2 - Low: -1 Day 3 High: 7 Day 3 - Low: -3 Day 4 - High: 9 Day 4 - Low: -4 Day Hi Low 1 6 -2 2 8 -1 3 7 -3 4 9 -4 The highest temperature was 9 on day 4 The lowest temperature was -4 on day 4 Enter a number between 1 and 4 to see the average temperature for the entered number of days, enter a negative number to exit: 5 Invalid entry, please enter a number between 1 and 4, inclusive: 3 The average temperature up to day 3 is: 2.50 Enter a number between 1 and 4 to see the average temperature for the entered number of days, enter a negative number to exit: 2 The average temperature up to day 2 is: 2.75 Enter a number between 1 and 4 to see the average temperature for the entered number of days, enter a negative number to exit: -1 Goodbye
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