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 (TEMPS_PER_DAY readings per day for DAYS_MEASURED days) in the range of [MIN_TEMP ... MAX_TEMP] 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 DAYS_MEASURED, TEMPS_PER_DAY, MIN_TEMP and MAX_TEMP. Generate ARRAYSIZE random integers in the range from MIN_TEMP to MAX_TEMP (inclusive), storing them in consecutive elements of array tempArray. (e.g. for MIN_TEMP =20 and MAX_TEMP =80, generate values from the set [20,21,...80]) HINT: How big will you need to make ARRAYSIZE to ensure your array can hold all the temperature measurements? DAYS_MEASURED should be initially set to 14 TEMPS_PER_DAY should be initially set to 11 MIN_TEMP should be initially set to 20 MAX_TEMP should be initially set to 80 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 DAYS_MEASURED. Find the lowest temperature of each day. Store these values into a different array of length DAYS_MEASURED. 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 procedures/parameters 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: intro1(reference, input), intro2(reference, input),...) You should also use this procedure for a farewell message, if you include one. generateTemperatures {parameters: tempArray (reference, output)} MIN_TEMP, MAX_TEMP, DAYS_MEASURED, TEMPS_PER_DAY will be used as globals within this procedure. findDailyHighs {parameters: tempArray (reference, input), dailyHighs (reference, output)} DAYS_MEASURED and TEMPS_PER_DAY will be used as globals within this procedure. findDailyLows {parameters: tempArray (reference, input), dailyLows (reference, output)} DAYS_MEASURED and TEMPS_PER_DAY will be used as globals within this procedure. calcAverageLowHighTemps {parameters: dailyHighs (reference, input), dailyLows (reference, input), averageHigh (reference, output), averageLow (reference, output)} DAYS_MEASURED 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 1. 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 DAYS_MEASURED, TEMPS_PER_DAY, MIN_TEMP and MAX_TEMP 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 7, Exploration 1- Passing Parameters on the Stack for method). Strings/arrays 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 irvine32.inc

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 Programming Questions!