Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Construct a VI that generates a random number between 10 and 10. The VI should d

ID: 3882759 • Letter: C

Question

Construct a VI that generates a random number between 10 and 10. The VI should display the random number on an indicator on the front panel and then light an LED corresponding to the range in which the number falls. Use one LED for negative values of the random number, one LED for values in the range of 0 to 4, and one LED for values greater or equal to 5. Change the properties of the LEDs so that they are bright yellow when turned on and dark yellow when off. Use descriptive labels for the indicators and use the tools on the Align Objects and Distribute Objects menus to space the objects evenly on the block diagram and front panel.

Explanation / Answer

#include #define MAX 10 int a[MAX]; int rand_seed=10; /* from K&R - returns random number between 0 and 32767.*/ int rand() { rand_seed = rand_seed * 1103515245 +12345; return (unsigned int)(rand_seed / 65536) % 32768; } int main() { int i,t,x,y; /* fill array */ for (i=0; i