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

Problem 4 In astronomy, luminosity is the total amount of energy emitted per uni

ID: 3747790 • Letter: P

Question

Problem 4 In astronomy, luminosity is the total amount of energy emitted per unit of time by a star, galaxy, or other astronomical object. We can calculate the luminosity, L, of a star using its apparent brightness, b (how bright it looks from earth), and the star's distance from the observer, d, using the formula: Write a function luminosity that implements this formula. Your function MUST be named luminosity Your function should accept two input arguments: brightness and distance, as doubles Your function should return the value of the luminosity as an int (you will have to cast it to an integer value) Your function should not print/display/output anything . For t use the value 3.14159 For example, given initial values of: b -1.5 and d 17.8, your function would return 5972.

Explanation / Answer

int luminosity(double brightness, double distance) {

return (int)(4*3.14159 * brightness * distance * distance);
}

Sample run:

luminosity(1.5, 17.8) = 5972

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote