Write C++ program that calculates the intensity of light onto a NBA basketball court. A standard...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write C++ 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. Criteria/Data File: A data file called lights.txt is available on Canvas with the following data and in this order: o Option letter (to be echoed back out) o Number of floodlights installed o Character to determine if the measurements are (G)iven or (R)andom. (If random then you need to randomly produce the position of are (G)iven or (R)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 position N222UNAN NAND 2 G 25 55 25 400 20 B G 25 C3R 55 25 1000 30 с 400 35 23.5 70.5 23.5 70.5 Write C++ 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. Criteria/Data File: A data file called lights.txt is available on Canvas with the following data and in this order: o Option letter (to be echoed back out) o Number of floodlights installed o Character to determine if the measurements are (G)iven or (R)andom. (If random then you need to randomly produce the position of are (G)iven or (R)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 position N222UNAN NAND 2 G 25 55 25 400 20 B G 25 C3R 55 25 1000 30 с 400 35 23.5 70.5 23.5 70.5
Expert Answer:
Answer rating: 100% (QA)
Here is an example C program that calculates the intensity of light onto a NBA basketball court based on the given criteria in the data file Note that ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In Chapter 22, the intensity of light striking a surface was related to the electric field of the associated electromagnetic wave. For photons, the intensity is the number of photons striking a 1-m2...
-
The intensity of light (in appropriate units) passing through water decreases exponentially with the depth it penetrates beneath the surface according to the function I(x) = 10e -0.3x, where x is the...
-
The intensity of light decreases as the inverse square of the distance from the source. Does this mean that light energy is lost? Explain.
-
Assume that self-esteem measurements are not affected by an interaction between subject self-esteem and target self-esteem. Is there sufficient evidence to support the claim that the category of the...
-
1. Is there anything the team should have done when they received only three proposals by June 30? 2. Should the team consider the proposal from Asia General Contractors? Why? 3. After sharing their...
-
Carla Vista Corporation had the following transactions 1 Sold land (cost $11,200) for $14,700. 2 Issued common stock at par for $20,000. 3. Recorded depreciation on buildings for $16,200. 4 Pald...
-
What is an advantage of calculating all three measures of central tendency?
-
The following situations represent excerpts from the responses to audit inquiries of external legal counsel of XYZ Co. during the annual audit of year 1 (legal response). For each excerpt, select the...
-
Design a plan that outlines how you would communicate, to the entire organization, these new metrics and their importance to supporting the recruiting process. Be certain to include steps for ongoing...
-
On January 1, 2020, Innovus, Inc., acquired 100 percent of the common stock of ChipTech Company for $670,000 in cash and other fair-value consideration. ChipTechs fair value was allocated among its...
-
2) In a 1953 study of stock prices, what did Maurice Kendall find and what does it mean in terms of the EMH? Explain 3) Even if the markets are efficient, you can find a job as a professional...
-
If air resistance is neglected, the motion of an object projected at an angle consists of a uniform downward acceleration combined with (a) an equal horizontal acceleration, (b) a uniform horizontal...
-
What is an asset-backed security?
-
What is the difference between the factor rate and the holdback rate?
-
Suppose that you were to step gently onto a bathroom scale, read the dial, and then jump from a chair onto the same scale. (a) Would the dial show different readings in the two cases? (b) Would the...
-
How are contingent liabilities accounted for under GAAP? a. Disclosed in the notes if it is probable that the company will incur a loss but the amount cannot be reasonably estimated. b. Reported on...
-
A pharmaceutical company is testing a new drug. Of the 110 people that received the drug, 61 of the people's autoimmune disease went into remission. Using the old drug the autoimmune disease for 50%...
-
What will be the final value of DI after executing the following piece of code? Execute the instructions dependently one after another. CLD MOU CX,OFOH MOU AX.02874H MOU DI,01000H MOU ES, DI SUB...
-
Suppose that you and two classmates are discussing the design of a roller coaster. One classmate says that each summit must be lower than the previous one. Your other classmate says this is nonsense,...
-
A certain spring stretches 6 cm when a load of 30 N is suspended from it. How much will the spring stretch if 50 N is suspended from it (and it doesn't reach its elastic limit)?
-
Why does the presence of large bodies of water tend to moderate the climate of nearby land-to make it warmer in cold weather and cooler in hot weather?
-
Test for misspecification using RESET.
-
a. Show that the mean-squared forecast error \(E\left[\left(\hat{y}_{T+1}-y_{T+1} ight)^{2} \mid I_{T} ight]\) for a forecast \(\hat{y}_{T+1}\), that depends only on past information \(I_{T}\), can...
-
Consider the AR(1) model \(y_{t}=\delta+\theta y_{t-1}+e_{t}\) where \(|\theta|)=0\) and \(\operatorname{var}\left(e_{t} \mid I_{t-1} ight)=\sigma^{2}\). Let \(\bar{y}_{-1}=\sum_{t=2}^{T} y_{t}...
Study smarter with the SolutionInn App