Question: Write and test a MASM program to generate a series of temperature readings ( TEMPS _ PER _ DAY readings per day for DAYS _
Write and test a MASM program to generate a series of temperature readings TEMPSPERDAY readings per day for DAYSMEASURED days in the range of MINTEMP MAXTEMP into one array. Once this array is generated, calculate the highest and lowest temperature reading for each day, then calculate the average of each of these daily high and low temperatures. Display all this information with descriptive titles. More info on this program follows check the Requirements section for specifics on program modularization: Introduce the program and programmer, and describe the program functionality. Declare global constants DAYSMEASURED, TEMPSPERDAY, MINTEMP and MAXTEMP. Generate ARRAYSIZE random integers in the range from MINTEMP to MAXTEMP inclusive storing them in consecutive elements of array tempArray. eg for MINTEMP and MAXTEMP generate values from the set HINT: How big will you need to make ARRAYSIZE to ensure your array can hold all the temperature measurements? DAYSMEASURED should be initially set to TEMPSPERDAY should be initially set to MINTEMP should be initially set to MAXTEMP should be initially set to Hint: Call Randomize once at the beginning of main to generate a random seed. Later, use RandomRange to generate each random number. Find the highest temperature of each day. Store these values into an array of length DAYSMEASURED. Find the lowest temperature of each day. Store these values into a different array of length DAYSMEASURED. Calculate the truncated average of the array of high temperatures storing this into a variable and the truncated average of the array of low temperatures storing this into another variable Display the list of temperature values, with one day's values printed on each line and one space between each value, and a descriptive title. Display the list of daily high temperatures with one space between each value, and a descriptive title. Display the list of daily low temperatures with one space between each value, and a descriptive title. Display the average high temperature with a descriptive title. Display the average low temperature with a descriptive title. Program Requirements The program must be constructed using procedures. At least the following proceduresparameters are required: NOTE: Regarding the syntax used below: procName parameters: varA value input varB reference output indicates that procedure procName must be passed varA as a value and varB as a reference, and that varA is an input parameter and varB is an output parameter. You may use more parameters than those specified but try to only use them if you need them. main printGreeting parameters: introreference input introreference input You should also use this procedure for a farewell message, if you include one. generateTemperatures parameters: tempArray reference output MINTEMP, MAXTEMP, DAYSMEASURED, TEMPSPERDAY will be used as globals within this procedure. findDailyHighs parameters: tempArray reference input dailyHighs reference output DAYSMEASURED and TEMPSPERDAY will be used as globals within this procedure. findDailyLows parameters: tempArray reference input dailyLows reference output DAYSMEASURED and TEMPSPERDAY will be used as globals within this procedure. calcAverageLowHighTemps parameters: dailyHighs reference input dailyLows reference input averageHigh reference output averageLow reference output DAYSMEASURED will be used as a global within this procedure. displayTempArray parameters: someTitle reference input someArray reference input someRows value input someColumns value input You will use this to print the big temperature array and also the low and high temperature arrays. Be careful to construct it so it can print "someRows" rows and each row will have "someColumn" elements, even if the number of rows or columns is displayTempwithString parameters: someTitle reference input someValue value input You will use this to print both the average high and the average low temperature. It should print a string and then a decimal value. Procedures except main must not reference data segment variables by name. There is a significant penalty attached to violations of this rule. tempArray, dailyHighs, dailyLows, titles for the arrays, etc... should be declared in the data preceding main, but must be passed to procedures on the stack. Constants DAYSMEASURED, TEMPSPERDAY, MINTEMP and MAXTEMP may be used by name in procedures as needed, since they are global constants. Parameters must be passed on the system stack, by value or by reference, as noted above see Module Exploration Passing Parameters on the Stack for method Stringsarrays must be passed by reference. Since you will not be using globals except the constants the program must use one or more of the use only irvineinc
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
