Calculate the average and maximum and minimum values

Assignment Help Computer Engineering
Reference no: EM132208351

Write a Program in C (NOT C++)

You are building a mini-weather station in your apartment in Florida and want to store a series of ambient temperature readings every hour for 24 hours, and then find the average, maximum and minimum values for that day period. We start measuring at midnight (time 0:00) until midnight the following day (time: 24:00, or 0:00 the next day).

Actually, that makes it 25 readings, right?. We want to store the data collected in an array of integers called temp[], where index 0 (temp[0]) contains the reading at midnight, index 1 (temp[1]) contains the reading at 1:00 AM, index 2 is 2:00 AM and so on.

However, while we write and test the program we won't have access to the actual temperature sensor or the data acquisition system. So, we have to simulate the data collection. We can do this by generating random numbers between 60 and 100 (for degrees Fahrenheit) and inserting them into the array sequentially until we fill up the array.

(Never mind that the numbers won't be gradually increasing, peaking in the afternoon and then decreasing overnight, as one would expect ambient temperature to do.) Then, we calculate the average, maximum and minimum vales for that day and print them out as a simple table.

So, you will need to design a loop within main() to populate the array, one cell at a time. Moreover, you will need to write two programmer-defined functions:

1) The first function called get_value() will return a random integer between 60 and 100. This function will be called from main() and the value returned will be inserted into the proper location in the array.

2) The second function called calc_results(int [], int) will accept the entire array once it has been completely populated, and will identify the maximum and minimum temperatures, as well as calculate the average temperature for the day. Note that you will have to convert integer values into floating point values to calculate the average. It will also print out the 25 temperatures in a table as well as the three computed values.

The output should look like this: (assume June 30, 2017 is the day for which the values were collected):
Temperature Conditions on June 30, 2017:

Time of Day Temperature in degrees F

0 85

1 80

2 97

3 90

4 68

5 75

6 77

7 98

8 97

9 62

- -

- -

- -

24 89

Maximum Temperature for the day: <whatever> Degrees F

Minimum Temperature for the day: <whatever> Degrees F

Average Temperature for the day: <whatever.whatever> Degrees F

Reference no: EM132208351

Questions Cloud

Do you agree or disagree with the given statement : Do you agree or disagree with the following statement? Explain your reasons. An increase in non-timber values of trees increases the marginal benefit.
Briefly identify and discuss the characteristics of urine : Explain how ADH compensates for blood that contains too many solutes. Briefly identify and discuss the characteristics of urine
What is the numerical value of the partial derivative : What is the numerical value of the partial derivative of the function with respect to the price of gasoline (be sure to also include the + or - sign).
Calculate the total number of combinations of k elements : Write a program in C++ to calculate the total number of combinations of k elements in a set of N elements.
Calculate the average and maximum and minimum values : Write and test the program we won't have access to the actual temperature sensor or the data acquisition system.
A program where you keep reading strings from the input : Write a program in C++ where you keep reading strings from the input, and then: if the number of characters is three or less.
What is the portfolio beta and portfolio standard deviation : You have an investment that consists of 3 stocks. Stock 1 is worth $22,000 with a beta of 0.97. Stock 2 is worth $7,500 and has a beta of 1.2.
Find the partial market equilibrium price and quantity : Suppose the generators described below compete as price takers in a market with perfect competition and a price-dependent demand given by PD = -20p + 400.
What are the mean and standard deviation values : Suppose that you are creating a model to manage uncertainty and one of those uncertain variables in your model is X. You know the distribution of X is normal.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd