2014-05-01, 03:18 PM
Hey guys,
It's crunch time for college students, good luck to you all! If any of you have time to help, it would be greatly appreciated. Here's my project:
Program Description: Write a program that calculates the intensity of light onto a NBA basketball court. A standard NBA basketball court is 94 feet long and 50 feet wide. We will assume that every square foot is represented by a cell in a two-dimensional array (or matrix). Given certain criteria that you read in from a data file, you will need to calculate the intensity of light at each square foot of the court.
Your program must have the following 4 functions:
A. Calculate the intensity of light (see formulas below)
B. Calculate the distance from the light to the floor
C. Random number generator
D. Print out the results
Formulas: Fc=Cp/D^2 D=sqrt(b^2+h^2)
Where: Fc = is the level of light the candle (floodlight) produces
D = the distance the lamp is from the surface
Cp = the candle power of the lamp (in watts)
Use the second formula to calculate the distance (D) from the light to each position (cell) on the basketball court.
Here's the data file and what each number/character gives:
Data file:
A
2
G
25 23.5
25 70.5
400
20
B
2
G
25 23.5
25 70.5
1000
30
C
3
R
400
35
What each line means:
o Option letter (to be echoed back out)
o Number of floodlights installed
o Character to determine if the measurements are (G)iven or ®andom. (If random then you need to randomly produce the position of that number of floodlights.)
o For each given floodlight, the number of feet across the court (in the 50 direction) then the number of feet (in the 94 direction)
o Power of the floodlights in watts
o Distance (feet) the lights are mounted above the positions
Here's where I need your help. I'm pretty good with functions and inputting the data from the file, I'm just terrible at arrays. After I calculate the intensity of light(Fc), how do I put these values into an array? Any help with this at all would be greatly appreciated. I need more help with the array part of it, but I could use tips throughout the whole thing. Thank you!
It's crunch time for college students, good luck to you all! If any of you have time to help, it would be greatly appreciated. Here's my project:
Program Description: Write a program that calculates the intensity of light onto a NBA basketball court. A standard NBA basketball court is 94 feet long and 50 feet wide. We will assume that every square foot is represented by a cell in a two-dimensional array (or matrix). Given certain criteria that you read in from a data file, you will need to calculate the intensity of light at each square foot of the court.
Your program must have the following 4 functions:
A. Calculate the intensity of light (see formulas below)
B. Calculate the distance from the light to the floor
C. Random number generator
D. Print out the results
Formulas: Fc=Cp/D^2 D=sqrt(b^2+h^2)
Where: Fc = is the level of light the candle (floodlight) produces
D = the distance the lamp is from the surface
Cp = the candle power of the lamp (in watts)
Use the second formula to calculate the distance (D) from the light to each position (cell) on the basketball court.
Here's the data file and what each number/character gives:
Data file:
A
2
G
25 23.5
25 70.5
400
20
B
2
G
25 23.5
25 70.5
1000
30
C
3
R
400
35
What each line means:
o Option letter (to be echoed back out)
o Number of floodlights installed
o Character to determine if the measurements are (G)iven or ®andom. (If random then you need to randomly produce the position of that number of floodlights.)
o For each given floodlight, the number of feet across the court (in the 50 direction) then the number of feet (in the 94 direction)
o Power of the floodlights in watts
o Distance (feet) the lights are mounted above the positions
Here's where I need your help. I'm pretty good with functions and inputting the data from the file, I'm just terrible at arrays. After I calculate the intensity of light(Fc), how do I put these values into an array? Any help with this at all would be greatly appreciated. I need more help with the array part of it, but I could use tips throughout the whole thing. Thank you!

