Question: Use MIPS to write a program that calculates windchills for temperatures input by the user. Use this array with windchill factor: windfact: .float 1.192173, 1.248331,
Use MIPS to write a program that calculates windchills for temperatures input by the user.
Use this array with windchill factor:
windfact: .float 1.192173, 1.248331, 1.293705, 1.332, 1.365261, 1.394744, 1.421277, 1.44544, 1.467651, 1.488226, 1.507408, 1.525389, 1.54232, 1.558329, 1.573518, 1.587975, 1.601772, 1.614971, 1.627628, 1.639788, 1.651492, 1.662776,1.673672, 1.684208, 1.694409, 1.704297, 1.713893, 1.723215, 1.732279, 1.741101,1.749695, 1.758072, 1.766245, 1.774224, 1.782019, 1.789639, 1.797092, 1.804387,1.81153, 1.818528, 1.825387, 1.832114, 1.838713, 1.845191, 1.851551, 1.857798,1.863938, 1.869972, 1.875907, 1.881744, 1.887488, 1.893141, 1.898707, 1.904189,1.909589, 1.914910, 1.920155, 1.925326
The wind chill is defined for winds at least 3 miles/hour and for temperatures at or below 50 degrees. Your program will be able to calculate windchills for winds up to 60 miles/hour. You will need an array of floats for the wind speed factor, which you will use to calculate the windchill. This array will hold the wind speed factor for winds from 3 to 60 miles/hour, in locations [0] to [57].
The formula for windchill in Fahrenheit is below, with T as the temperature in Fahrenheit, and V as the wind speed factor, calculated in miles per hour:
windchill = 35.74 + 0.6215T - 35.75V + 0.4275TV
Your program will do the following:
- get the array of floats to hold the wind speed factors
- create float variables to hold the constants needed for the windchill calculation, and load those constants into registers to use in the windchill calculation
- create a loop to do the following:
- read in a temperature (int), stop looping when the user enters a temperature above 50
- calculate and print the windchills for this temperature, for all integer wind speeds from 3 to 60, rounding the windchills to the nearest int: output should look like the following
temp: xxx windspeed windchill 3 xxx 4 xxx 5 xxx 60 xxx
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
