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

You work for the Jet Propulsion Laboratory. They want you to write a program tha

ID: 440678 • Letter: Y

Question

You work for the Jet Propulsion Laboratory. They want you to write a program that will take a two-dimensional array containing the digitized representation of a picture of the night sky and locate the stars on it. Each element of the array represents the amount of light hitting that portion of the image when the picture was taken. Intensities can range from 0 (no light) to 20 (maximum light). Example input: 0 3 4 0 0 0 6 8 5 13 6 0 0 0 2 3 2 6 2 7 3 0 10 0 0 0 4 15 4 1 6 0 0 0 7 12 6 9 10 4 5 0 6 10 6 4 8 0 A star is probably located in the area covered by the array element I,J if the following is the case: (Array(i,j) + sum of the 4 surrounding intensities) / 5 > 6.0 Ignore possible stars along the edges of the matrix. The desired output is a star map containing asterisks where you have found a star and blanks elsewhere. Note: Output should be sent to the file picture.txt. Example output: ------------------------ | | * | | * | * * * | | INPUT FILE (project1.txt): An external text file containing 20 lines of data. Each line contains 20 integers. Therefore, your array(s) should be 20 x 20 in size. OUTPUT FILE (picture.txt): A star map (with a border). Print two blanks to indicate "no star" and one blank and an asterisk to indicate the presence of a star.

Explanation / Answer

include include include using namespace std; int main() const int NUM_STARS = 20; int i, j; float stars[i][j]; ifstream inputFile; ofstream outputFile; inputFile.open("project1.txt"); outputFile.open("picture.txt"); for(i=0;i stars[i][j]; inputFile.close(); outputFile >> "*"; outputFile.close(); cout 6.0
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